G
Guest
Using a Button to take an autonumbr from one form to populate another
autonumber field on another field.
I have a Mainform "A" with a button and code that opens another Mainform "B"
with a subform which has the same table as Mainform "A".
The button is supposed to tell the subform with the autonumber field that
whatever appears there should be the same number In Mainform A.
How do I add code to my button, that opens Mainform B, and reach down and
link to the its subform with the same populated autonumber field ?
This is the Open Form button code that I am using:
Private Sub Command116_Click()
On Error GoTo err_Command116_click
Dim stDocName As String
Dim stLinkCriteria As String
DoCmd.RunCommand acCmdSaveRecord
stDocName = "frmMain"
stLinkCriteria = "[txtGuestID]=" & Me![GuestID] 'BOTH ARE AUTONUMBER FIELDS
DoCmd.OpenForm stDocName, , , stLinkCriteria
exit_Command116_click:
Exit Sub
err_Command116_click:
'MsgBox "Type/Select a 'Entry's Name', before clicking on 'Registration'."
Resume exit_Command116_click
End Sub
John
autonumber field on another field.
I have a Mainform "A" with a button and code that opens another Mainform "B"
with a subform which has the same table as Mainform "A".
The button is supposed to tell the subform with the autonumber field that
whatever appears there should be the same number In Mainform A.
How do I add code to my button, that opens Mainform B, and reach down and
link to the its subform with the same populated autonumber field ?
This is the Open Form button code that I am using:
Private Sub Command116_Click()
On Error GoTo err_Command116_click
Dim stDocName As String
Dim stLinkCriteria As String
DoCmd.RunCommand acCmdSaveRecord
stDocName = "frmMain"
stLinkCriteria = "[txtGuestID]=" & Me![GuestID] 'BOTH ARE AUTONUMBER FIELDS
DoCmd.OpenForm stDocName, , , stLinkCriteria
exit_Command116_click:
Exit Sub
err_Command116_click:
'MsgBox "Type/Select a 'Entry's Name', before clicking on 'Registration'."
Resume exit_Command116_click
End Sub
John