Need some help with Option Buttons

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
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
 
Back
Top