What's Wrong With My Code?

debo33

Registered User.
Local time
Today, 10:50
Joined
Aug 8, 2003
Messages
18
What am I doing wrong?

After adding new subject (ID) to form 1, I want to add this new ID record to form 2, but the error appears to be in line 3. And, what is the equivalent OpenArgs statement for this?

Private Sub Command226_Click()
On Error GoTo Err_Command226_Click

Forms![form1]![form2].SetFocus

DoCmd.GoToRecord acActiveDataObject, , acNewRec
Forms![form1]![form2]![ID] = Forms![form1]![ID]

Exit_Command226_Click:
Exit Sub

Err_Command226_Click:
MsgBox Err.Description
Resume Exit_Command226_Click

End Sub

Best Regards,

debo
 
debo,

There are a couple ways of doing this:

The best is to make your "form2" a subform and use the
Master-Child links to "Synchronize" your forms. Access will
do all of the work for you!

Secondly, you can make the default value for [ID]:

=Forms![form1]![ID]

The only problem with this approach is that you have to
do all of the requerying to keep things in "synch".

Wayne
 

Users who are viewing this thread

Back
Top Bottom