Rabu, 04 April 2012

Re: [MS_AccessPros] Re: Add value from Previous record

 

John, that was perfect. Thank you very much.

With warm regards,

Arthur Lorenzini
Sioux Falls, South Dakota

________________________________
From: John Viescas <JohnV@msn.com>
To: MS_Access_Professionals@yahoogroups.com
Sent: Wednesday, April 4, 2012 12:42 PM
Subject: RE: [MS_AccessPros] Re: Add value from Previous record


 

Art-

Simply set the DefaultValue of the UnitID before going to the new record:

Private Sub cmdAddWorkOrder_Click()
Me.UnitID.DefaultValue = Me.UnitID
DoCmd.GoToRecord , , acNewRec
End Sub

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-------------------------

From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Art Lorenzini
Sent: Wednesday, April 04, 2012 6:58 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Re: Add value from Previous record

I am going to put a snapshot up of my form in the folder Assistance Needed to give you a better idea of what is going on. I am probably asking my question wrong.

The user has opened a specific work order for a specific UnitID. Now if they click add Work Order then I need it to pass the unitID to the new record. I probably worded my question wrong because the previous record might not have the correct UnitID I think I meant to say the Current record.

With warm regards,

Arthur Lorenzini
Sioux Falls, South Dakota

________________________________
From: Bill Mosca <wrmosca@comcast.net>
To: MS_Access_Professionals@yahoogroups.com
Sent: Wednesday, April 4, 2012 11:46 AM
Subject: [MS_AccessPros] Re: Add value from Previous record

Art

Private Sub Form_Current()
Dim rs As Object
Set rs = Me.Recordset.Clone

If rs.EOF Or Not Me.NewRecord Then
' don't do anything if there's no records or it is not a new record
Else
With rs

.MoveLast

Me![City] = .Fields("strCity")
Me![PostalCode] = .Fields("strPostalCode")
Me![Region] = .Fields("strRegion")
End With

End If

End Sub

Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
https://mvp.support.microsoft.com/profile/Bill.Mosca

--- In MS_Access_Professionals@yahoogroups.com, "Art" <dbalorenzini@...> wrote:
>
> I have a button called cmdNewWorkOrder on a form called frmWorkOrderDetails. Currently the code for the button is as follows:
>
> Private Sub cmdAddWorkOrder_Click()
> DoCmd.GoToRecord , , acNewRec
>
>
> End Sub
>
> But what I need to do is pass the value of UnitID from the previous record to the new record while the form is still open.
>
>
> Please advise.
>
> Thank you
> Art Lorenzini
>

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___

Tidak ada komentar:

Posting Komentar