C
Charles Hatfield
I want to be able to enter data on form1 that is bound to one table and
then click on a button to open form2 that is bound to another table. I
want to be able to
carry the value entered in field "FormNum" to the same field on form2.
I linked the two tables on the FormNum field.
I also reviewed the FAQ on Tech-Tips and found the following code from a
similar request and modified it accordingly:
Private Sub cmdOpen_Click()
On Error GoTo Err_cmdOpen_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Form2"
stLinkCriteria = "[FormNum]=" & Me![FormNum]
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdOpen_Click:
Exit Sub
Err_cmdOpen_Click:
MsgBox Err.Description
Resume Exit_cmdOpen_Click
End Sub
When I enter data on Form1 and click the button, Form2 opens but
without the "FormNum" value that was entered into the FormNum field on
Form1.
What I don't understand is that the stLinkCriteria is equaled to the
value entered on Form1 but doesn't appear in the FormNum field on Form2.
What am I doing wrong?.
then click on a button to open form2 that is bound to another table. I
want to be able to
carry the value entered in field "FormNum" to the same field on form2.
I linked the two tables on the FormNum field.
I also reviewed the FAQ on Tech-Tips and found the following code from a
similar request and modified it accordingly:
Private Sub cmdOpen_Click()
On Error GoTo Err_cmdOpen_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Form2"
stLinkCriteria = "[FormNum]=" & Me![FormNum]
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdOpen_Click:
Exit Sub
Err_cmdOpen_Click:
MsgBox Err.Description
Resume Exit_cmdOpen_Click
End Sub
When I enter data on Form1 and click the button, Form2 opens but
without the "FormNum" value that was entered into the FormNum field on
Form1.
What I don't understand is that the stLinkCriteria is equaled to the
value entered on Form1 but doesn't appear in the FormNum field on Form2.
What am I doing wrong?.