A family of Microsoft relational database management systems designed for ease of use.
You'll find an extensive series of tutorials at http://www.functionx.com/vbaccess/
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi all
I am trying to complete a query by form exercise.
So far I have unbound controls relating to both number and text fields and also a number of checkboxes.
The intention is to use vba code triggered by a command button to generate a concatenated string query.
The number field syntax works OK
If Not IsNull(txtItemNo) Then
If whereclause <> "" Then whereclause = whereclause & " AND "
whereclause = whereclause & "[ItemNo] = " & txtItemNo
End If
The text field syntax works OK
If Not IsNull(CmbDesign) Then
If whereclause <> "" Then whereclause = whereclause & " AND "
whereclause = whereclause & "[Design] = '" & CmbDesign & "'"
End If
If I have a yes/no field in my queried table called RVStatus and a check box named cbRVStatus on the query form, does anyone know the syntax for the corresponding clause which will test for yes (or true) and enter this value in a similar clause for the above query search string?
Many thanks
Phil
A family of Microsoft relational database management systems designed for ease of use.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
You'll find an extensive series of tutorials at http://www.functionx.com/vbaccess/
Answer accepted by question author
If you only want to add a condition if the check box is ticked:
If Me.cbRVStatus = True Then
If whereclause <> "" Then whereclause = whereclause & " AND "
whereclause = whereclause & "[RVStatus] = True"
End If
If you always want to add a condition corresponding to the value of the check box:
If whereclause <> "" Then whereclause = whereclause & " AND "
whereclause = whereclause & "[RVStatus] = " & Me.cbRVStatus
Many thanks Hans
The first clause is just the job.
Are there any go to web sites that cover this "just above basic" level access and vba type content?
I seem to be asking numerous questions which are sort of covered on forums but not quite. I don't have the understanding yet to be able to transpose what I find into working code. If there was a source of more examples spelled out for a dummy that would be a good start.
Phil