I'm having trouble assigning a value to a long variable using a text box on a form. Here's the code:
Dim strSQL As String
Dim strOpenForm As String
Dim strCloseForm As String
Dim lngContactID As Long
lngContactID = Me.SelectedContactID.Value
strOpenForm = "FrmContact"
strCloseForm = "FrmContactsByInterest"
strSQL = "ContactID = lngContactID"
DoCmd.OpenForm strOpenForm, , , strSQL
DoCmd.Close acForm, strCloseForm
I get a message box asking for lngContactID when I run it. Can anyone tell me why?
Dim strSQL As String
Dim strOpenForm As String
Dim strCloseForm As String
Dim lngContactID As Long
lngContactID = Me.SelectedContactID.Value
strOpenForm = "FrmContact"
strCloseForm = "FrmContactsByInterest"
strSQL = "ContactID = lngContactID"
DoCmd.OpenForm strOpenForm, , , strSQL
DoCmd.Close acForm, strCloseForm
I get a message box asking for lngContactID when I run it. Can anyone tell me why?