Passing Auto Number to other Forms

supportt

Registered User.
Local time
Today, 18:11
Joined
Nov 21, 2001
Messages
70
I have three forms and the first one generates a unique number, I would like that number to be passed to other forms. The main form generates the number and I have two other buttons on the form to access the other forms. When I click on the button for the other forms, I would like to pass the unique number?
 
Use want to utilze the OpenArgs.

This is an argument that can be set with Code in the DoCmd.OpenForm method.

The information in help is vague so I have posted an example.

On the Event to open the other form:

DoCmd.OpenForm "frmEnterEvalData", acNormal, , , acFormAdd, , Me.MaterialID


On the other form OnLoad event.

Me.MaterialID = Me.OpenArgs


Hope that helps.
 
If you are adding new info after you click the buttons then you could use the OnClick Event on each of the buttons…You could do something like this:

Private Sub AddCreditAdditionalInfo_Click()
On Error GoTo AddCreditAdditionalInfo_Click_Err

DoCmd.OpenForm "frm-tblCredit", , , , acAdd
Forms![frm-tblCredit]![ContactID] = Me.ContactID

AddCreditAdditionalInfo_Click_Exit:
Exit Sub
AddCreditAdditionalInfo_Click_Err:
MsgBox Error$
Resume AddCreditAdditionalInfo_Click_Exit
End Sub


Hope This Helps,

Don

Edited because of a typo and, the above post was not here when I started this Reply...

[This message has been edited by donbettis (edited 11-21-2001).]
 
You will need to save the current record of the main form prior to opening the subsequent forms -

DoCmd.RunCommand acCmdSaveRecord

Put the save record command in the click event of the button, prior to the OpenForm Method.
 

Users who are viewing this thread

Back
Top Bottom