Hello Everyone,
I seem to be running into a slight problem that I think should be fairly easy, but given my lack of skills with Access I am having trouble figuring it out. I have a form that adds new records to a database with the PK set to an autonumber incremental field. After the users clicks on the create button I would like to open another form using the PK from the form that was just created. I have come very close I feel to solving this problem but for some reason just cant get everything to work out. When the user wants to save the information the have entered into the database I have a button with the following code:
Code:
Private Sub AddCertificate_Click()
DoCmd.GoToRecord , , acNewRec
End Sub
In the AfterUpdate Event of the form I have this code grabbing the PK from the form that the information is entered on:
Code:
Private Sub Form_AfterUpdate()
Dim TempCert As Integer
TempCert = DLast("CERTNO", "dbo_RMA")
MsgBox (TempCert)
DoCmd.OpenForm "Cert of Conformance", acNormal, , "[CERTNO] = TempCert"
End Sub
Now I only placed to MsgBox in there to check and see if the DLast command was working and it is, because when the MsgBox pops up I see the PK from the last entered record. My problem comes when the OpenForm command executes because for some reason it doesn't see the value stored in the TempCert variable and prompts the user with a message box asking for the TempCert value. Any help is greatly appreciated!!