QBF cbo for a Yes/No field

  • Thread starter Thread starter Gary Schuldt
  • Start date Start date
G

Gary Schuldt

I have a table tPlant with a Yes/No field named Cones, which is not a
Required field.

I want to use a Query-By-Form frmQBF with Cones as one of the selection
criteria.

I want to allow the user to make one of 3 choices for Cones: Yes, No, and
Don't Care.

Don't Care would mean any value in that field would be acceptable (Yes, No,
or Null).

I am using unbound combo boxes for other selection fields, which are all
Text. That works fine.

I'd like to use a combo for Cones, but I can't figure out how to code the
cboCones properties RecordSourceType and RecordSource.

Any suggestions? It doesn't have to be a combo box, I guess, but I need to
be able to depict the three options.

Gary
 
---------- "Gary Schuldt said:
I have a table tPlant with a Yes/No field named Cones, which is not a
Required field.

I want to use a Query-By-Form frmQBF with Cones as one of the selection
criteria.

I want to allow the user to make one of 3 choices for Cones: Yes, No, and
Don't Care.

Don't Care would mean any value in that field would be acceptable (Yes, No,
or Null).

I am using unbound combo boxes for other selection fields, which are all
Text. That works fine.

I'd like to use a combo for Cones, but I can't figure out how to code the
cboCones properties RecordSourceType and RecordSource.

Gary,

you could try this:

RecordSourceType: Value list
RecordSource: Null;"Don't Care";-1;"Yes";0;"No"
Bound Column: 1
Column Width: 0;0.5

The first column will be invisible but its value will be stored in the
combo.
..
Then in the code for putting together the SQL statement:

If Not IsNull(Me![MyComboCones]) Then
strCones = strCones & "[Cones] =" & Me![MyComboCones]

'Further code to concatenate the Cones criteria with the rest
'of the statement
End If

HTH

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
 
Emilia,

Thanks. I understand your suggestions for the ComboBox value list and
properties.

I have a follow-on question: I am using Steve Schapel's suggestion for
constructing my query using the QBE pane:

-->Make your report based on a query, and in the query criteria
of each of the fields, put the equivalent of...
Like Nz([Forms]![NameOfForm]![NameOfCombobox],"*") <--

I know the "*" wildcard works for text fields, but can I also use the same
logic on a Yes/No field?

It would be great if I could combine your ComboBox value list with the Like
Nz criterion above to mean "any value in the Cones field".

Gary


Emilia Maxim said:
---------- "Gary Schuldt said:
I have a table tPlant with a Yes/No field named Cones, which is not a
Required field.

I want to use a Query-By-Form frmQBF with Cones as one of the selection
criteria.

I want to allow the user to make one of 3 choices for Cones: Yes, No, and
Don't Care.

Don't Care would mean any value in that field would be acceptable (Yes, No,
or Null).

I am using unbound combo boxes for other selection fields, which are all
Text. That works fine.

I'd like to use a combo for Cones, but I can't figure out how to code the
cboCones properties RecordSourceType and RecordSource.

Gary,

you could try this:

RecordSourceType: Value list
RecordSource: Null;"Don't Care";-1;"Yes";0;"No"
Bound Column: 1
Column Width: 0;0.5

The first column will be invisible but its value will be stored in the
combo.
.
Then in the code for putting together the SQL statement:

If Not IsNull(Me![MyComboCones]) Then
strCones = strCones & "[Cones] =" & Me![MyComboCones]

'Further code to concatenate the Cones criteria with the rest
'of the statement
End If

HTH

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
 
Back
Top