IF HELP

J

John W. Vinson

On Sun, 13 Jul 2008 21:53:01 -0700, jerseygirl54

Thanks. You need a THEN, just as the error message suggested. Try

Dim strCriteria As String

'only do the search if a name has been selected
If Not IsNull(Me.[cboOfficer]) Then
'build criterion for search
strCriteria = "[Officer ID]=" & Me.[cboOfficer]
' This assumes that Officer ID is a Number datatype
' if it is Text instead use
' strCriteria = "[Officer ID]='" & Me.[cboOfficer] & "'"

'open form filtered to selected person
DoCmd.OpenForm "frmOfficerRoster", WhereCondition:=strCriteria

'close dialogue form
DoCmd.Close acForm, Me.Name
Else
'otherwise inform user
MsgBox "No officer selected.", vbInformation, "Invalid Operation":

End If
 
J

jerseygirl54

I don't have an error any more, BUT...(for testing purposes) I entered part
of a name. It then asks me for an officer ID, which one would not have if
they are searching by name. I don't enter a number, then I get a list of
possible matches. Problem is that I am unable to select any name from the
list. I have to reenter the name, spelled correctly in order for it to pull
it up. Also, if you misspell a name or enter a name that is not on the list,
it does not give notification (message box) suggesting that you might have
spelled the name wrong as there is no such name in the list.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top