
Originally Posted by
Bkndbrown
I am sure this is easy but it is kicking my butt. I have a text box called SearchID I want it to count entries in SponsorDataT, field called LastINILast4SSN. If there are any matches open a record with that record if not open a new record. Sorry if code is messed up had to go computer to phone to here. Stupid firewall.
Private Sub Command13_Click()
If DCount("[LastINILast4SSN]", "[SponsorDataT]", "Forms![OpeningF]![SearchID]") < 0 Then
DoCmd.OpenForm "SponsorDataSF", acNormal, "", "", acAdd, acNormal
DoCmd.GoToRecord , , acNewRec
Else
DoCmd.OpenForm "SponsorDataSF", acNormal, "", "", acEdit, acNormal
DoCmd.SearchForRecord acForm, "SponsorDataSF", acFirst, "LastINILast4SSN = '" & Forms!OpeningF!SearchID & "'"
End If
End Sub