Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

i get a else without if statement when running if statment

Status
Not open for further replies.

at51178

Technical User
Mar 25, 2002
587
0
0
US
Hey guys
I believe I am writing this right but I get a else without if error message anyone can help me with this here is the code.

If optLastName.Value = 1 And OptFirstName.Value = 0 Then Me.RecordSource = "SELECT tblmain.LastName, tblmain.firstName " & "FROM tblmain " & "WHERE tblmain.LastName LIKE '*" & txtSearch & "*';"
Else
If optLastName.Value = 0 And OptFirstName.Value = 1 Then Me.RecordSource = "SELECT tblmain.LastName, tblmain.firstName " & "FROM tblmain " & "WHERE tblmain.FirstName LIKE '*" & txtSearch & "*';"
End If
 
I figured out the problem the option buttons are in a frame and for some reason it didn't work.
I created two more option buttons out of a frame and it worked perfectly.
here is the code

If Option13.Value = True Then
Me.RecordSource = "SELECT tblmain.LastName, tblmain.firstName " & "FROM tblmain " & "WHERE tblmain.LastName LIKE '*" & txtSearch & "*';"
ElseIf Option15.Value = True Then
Me.RecordSource = "SELECT tblmain.LastName, tblmain.firstName " & "FROM tblmain " & "WHERE tblmain.FirstName LIKE '*" & txtSearch & "*';"
End If
 
Ok well I assumed the option buttons were directly on your form. To use option buttons on a frame you would have to reference the frame first.

if frame1.option1.value = true ...


Transcend
[gorgeous]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top