Need some help with Option Buttons

G

Guest

I have a search form that works nicely, EXCEPT I need to add an additional
elementto it. I have a filed in my main table (strType) that holds a value
(either "1", or "2") based on an Option Group. I would like to offer the
users the ability to optionally include this in the search of records that
display in a subform. They simply select from an unbound Group in the same
manner they would had from the main form. Here's what VB I have so far that
works, but I am not sertain how the syntax would be included to retrieve
records with the strType value either as "1" or "2". Any help would be
appreciatedtried adding (not VBA aware) this optional search element.

If Type
If Nz(Me.strType) <> "" Then
'Add the Predicate
strWhere = strWhere & " AND " & "tblSickLeaveData.[strType] = '" &
Me.strType & "'"
End If
 
C

Carl Rapson

Coleman said:
I have a search form that works nicely, EXCEPT I need to add an additional
elementto it. I have a filed in my main table (strType) that holds a
value
(either "1", or "2") based on an Option Group. I would like to offer the
users the ability to optionally include this in the search of records that
display in a subform. They simply select from an unbound Group in the
same
manner they would had from the main form. Here's what VB I have so far
that
works, but I am not sertain how the syntax would be included to retrieve
records with the strType value either as "1" or "2". Any help would be
appreciatedtried adding (not VBA aware) this optional search element.

If Type
If Nz(Me.strType) <> "" Then
'Add the Predicate
strWhere = strWhere & " AND " & "tblSickLeaveData.[strType] = '" &
Me.strType & "'"
End If

If strType is a numeric field in the table, you don't want to surround it
with quotes:

strWhere = strWhere & " AND " & "tblSickLeaveData.[strType] = " &
Me.strType

Carl Rapson
 
G

Guest

Carl,

Thanks for the reply..that fixed it!!

Carl Rapson said:
Coleman said:
I have a search form that works nicely, EXCEPT I need to add an additional
elementto it. I have a filed in my main table (strType) that holds a
value
(either "1", or "2") based on an Option Group. I would like to offer the
users the ability to optionally include this in the search of records that
display in a subform. They simply select from an unbound Group in the
same
manner they would had from the main form. Here's what VB I have so far
that
works, but I am not sertain how the syntax would be included to retrieve
records with the strType value either as "1" or "2". Any help would be
appreciatedtried adding (not VBA aware) this optional search element.

If Type
If Nz(Me.strType) <> "" Then
'Add the Predicate
strWhere = strWhere & " AND " & "tblSickLeaveData.[strType] = '" &
Me.strType & "'"
End If

If strType is a numeric field in the table, you don't want to surround it
with quotes:

strWhere = strWhere & " AND " & "tblSickLeaveData.[strType] = " &
Me.strType

Carl Rapson
 

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