It highlights the first row, "Dim strMsg As String"? If so, check this
link
to repair your References.
http://www.allenbrowne.com/ser-38.html
--
Wayne Morgan
MS Access MVP
Well thanks for the response
This is the code I have now
Private Sub Command33_Click()
Dim strMsg As String
If (Nz(Me.[TA Created By], "") = "") Then
strMsg = "Please Choose POV GIVEN TO-Only Continue if you are
ready
to submit POV."
If MsgBox(strMsg, vbRetryCancel + vbExlcamation, "Incomplete Data")
=
vbRetry Then
Me.[TA Created By].SetFocus
Exit Sub
Else
Me.Undo
DoCmd.Close acForm, Me.[Another Test Mileage], acSaveNo
Exit Sub
End If
It says compile error and hilights the first row.
Can you help me in figuring out where I went wrong.
Thanks
:
Yes, it can be done by using the MsgBox function instead of the MsgBox
statement (note the parentheses in the new statement). Also, the first
If...Then line can be shortened slightly.
Dim strMsg As String
If (Nz(Me.[TA Created By], "") = "") Then
'variable used to make MsgBox function shorter and easier to read
strMsg = "Please Choose POV GIVEN TO-Only Continue if you are
ready
to
submit POV."
If MsgBox(strMsg, vbRetryCancel + vbExlcamation, "Incomplete
Data") =
vbRetry Then
Me.[TA Created By].SetFocus
Exit Sub
Else
'I'm just guessing on what you might want here
Me.Undo
DoCmd.Close acForm, Me.Name, acSaveNo
Exit Sub
End If
DoCmd.OpenReport "For Mileage", acViewNormal, , "[ID]=[Forms]![Another
Test
Mileage]![ID]"
'DoCmd.Close
'I recommend that you specify what to close
'otherwise, you'll close the item with the focus
DoCmd.Close acForm, Me.Name, acSaveNo
--
Wayne Morgan
MS Access MVP
I have this code for a command button
If (IsNull(Me.[TA Created By]) Or Me.[TA Created By] = "") Then
MsgBox "Please Choose POV GIVEN TO-Only Continue if you are ready
to
submit POV."
Me.[TA Created By].SetFocus
Exit Sub
End If
DoCmd.OpenReport "For Mileage", acViewNormal, ,
"[ID]=[Forms]![Another
Test
Mileage]![ID]"
DoCmd.Close
When the error mesg. pops up I would like a yes no box. That says
yes
continue or no Close. So if it is yes return to form, if no then
close.
Can this be done?
Thanks for your help.
Cheyenne