ALSO!
I put my question out in another forum, and this was the code that I was given to sort it all out. I have one table that is linked to some other ones by a customer Id. I want the same thing to happen. When you enter info into the first form, and then push the button to open the next one, there will either be: A. The related reccord because you already entered it, or B. a reccord with the related field all nicely filled in for you so you don't have to do it a million times. Maybe this will help you. (I can't seem to get it to work for me, but that's probably because I have very little VBA knowledge. Either that, or I'm a dolt.)
:
Dim StrLinkCriteria As String 'Declare the variable StrLinkCriteria
Dim stDocName As String 'Declare the variable stDocName
stDocName = "Section B" 'Define stDocName
'If there is already a record corresponding to the ApplicantID in Section B
'Open the form with that record
If DLookup("[ApplicantID]", "[Section B]", "[ApplicantID]=" & Forms![SECTION A]![ApplicantID]) Then
'Define StrLinkCriteria, open the form in edit mode and requery the source for the form
StrLinkCriteria = "[ApplicantID] = Forms![Section A]![ApplicantID]"
DoCmd.OpenForm stDocName, , , StrLinkCriteria
DoCmd.Requery
'Otherwise open the form in add mode and set the OpenArgs value to the ApplicantID
Else
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenForm stDocName, , , , acAdd, , Me!ApplicantID
You just have to substitute your own table and form names.
What this does though is it first copies the applicantID to opening arguments then it looks to see whether a record exists and if not will create the new record with the same applicantID (which was copied to opening arguments)
HTH
Kate [sig][/sig]