Code:
Private Sub open_address_form_Click()
On Error GoTo Err_open_address_form_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "BusinessAddress"
If DLookup("[company_id]", "[businessaddress]=", "[company_id]=" & Forms![BusinessInformation]![Company_ID]) Then
strlinkcriteria = "[company_id]= forms![BusinessInformation]![company_id]"
DoCmd.OpenForm stDocName, , , strlinkcriteria
DoCmd.Requery
Else
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenForm stDocName, , , , acFormAdd, , Me![Company_ID]
Exit_open_address_form_Click:
Exit Sub
Err_open_address_form_Click:
MsgBox Err.Description
Resume Exit_open_address_form_Click
End If
End Sub
It's telling me that it can't find the form "BusinessInformation" I have tried everything to change it so the thing will recognize it. The only think I can think, (other than I screwed the code) is that it doesn't like that it's open. But that doesn't make sense! I hope someone can help. I am just doing this all wrong.