Hey all, everytime I open the form Clickform with a button, I keep getting a runtime error 3464- data type mismatch in criteria expression with the DoCmd line highlighted.
Basically I have a group of checkboxes (Check1, Check2, etc.) on a form called Check, and the code filters through the checkboxes to see which ones are checked. Once the user clicks the button (called Command0), it opens up the Clickform and applies a filter based on the checkboxes. For instance, if Check3 and Check4 are highlighted, then the Checkform will be filtered on the records where Door=4 or Door=5. Here's my code: - Option Compare Database
-
Option Base 1
-
-
Private Sub Command0_Click()
-
-
Dim Ctrl As Object, i, j, RecsChose, ThisChkbox, ErrMess, sqlStr, sqlPl
-
Dim Narr() As Variant
-
-
ThisChkbox = 0
-
i = 0
-
-
For Each Ctrl In Me.Controls
-
If (Ctrl.ControlType = 106) Then
-
ThisChkbox = Ctrl.Value
-
If ThisChkbox Then
-
i = i + 1
-
ReDim Preserve Narr(i)
-
Narr(i) = Ctrl.DefaultValue
-
End If
-
End If
-
Next
-
-
If i > 0 Then
-
For j = 1 To UBound(Narr) - 1
-
RecsChose = RecsChose & "Trailers_Unloading_LA.Door=" & Narr(j) & " OR "
-
Next
-
RecsChose = RecsChose & "Trailers_Unloading_LA.Door=" & Narr(j) & ";"
-
sqlP1 = "SELECT Trailers_Unloading_LA.Door, Trailers_Unloading_LA.Trailer_Number, Trailers_Unloading_LA.LA01, Trailers_Unloading_LA.LA02, Trailers_Unloading_LA.LA03, Trailers_Unloading_LA.LA04, Trailers_Unloading_LA.LA05, Trailers_Unloading_LA.LA06, Trailers_Unloading_LA.LA07, Trailers_Unloading_LA.LA08, Trailers_Unloading_LA.LA09, Trailers_Unloading_LA.LA10 FROM Trailers_Unloading_LA WHERE "
-
sqlStr = sqlP1 & RecsChose
-
Else
-
ErrMess = MsgBox("No trailers are being unloaded", vbOKOnly, "Status")
-
End If
-
-
Debug.Print sqlStr
-
-
DoCmd.OpenForm "CheckForm", acNormal, sqlStr, , acFormReadOnly, acWindowNormal
-
-
End Sub
-
Any ideas why this is not working? I can't seem to figure it out after scouring the internet looking for reasons why it might not be working..
Is Door a string? If so you need to surround the values in quotes.
4 3341
Is Door a string? If so you need to surround the values in quotes.
Ahhh yes, something so simple. Thanks rabbit.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dave Elliott |
last post by:
I have a form named Add Products where I enter Products with a Category ID,
Category Name & Category Description. I want the form to open showing only
the records assocated with the Category Labor...
|
by: P |
last post by:
Hi,
Access 2002. I am trying to use the PrintOut function to print the current
record of the current open form in landscape format to the default Windows
printer. Any suggestion on how to set...
|
by: allyn44 |
last post by:
Hello,
I have built a serch form for users to edit records. I only want them
to pull up the record they need, and I want to check for nulls. There
should not be dupes becasue the underlying...
|
by: StellaUK |
last post by:
I have Seen Loads Of Post On This And I Have Spent The Last Hour Trying Everything I Come Across But Still Can Get What I Thought Was A Simple Thing To Work .. LOL
I Have 2 Forms
Vehicles...
|
by: kev |
last post by:
Hi folks,
I have a form for registration (frmRegistration) whereby i have two
buttons. One is Save which saves record using the OnClick property. I
used wizard to create the save button. The...
|
by: keri |
last post by:
Hi,
Simple version of the question.....
How do I use the where clause of the open form command to show an
account with a matching ID to be displayed when the form is opened?
Eg. I select a...
|
by: SDave |
last post by:
I have read several responses to this problem around the web, but my programming knowledge wasn't strong enough to translate those responses to my problem.
I have a database with one table, the...
|
by: Beatrice |
last post by:
I need to open a form selecting all data from a previous form i.e:
Form 1)
combo box 1 named "cboYearSelect" displayed as "Year" based on qry QryYearList ( only one field "Year")
...
|
by: Lebbsy |
last post by:
After displaying search results, I want to be able to double click the identity number field and then the input form SubmissionDetails becomes the display form for the results of the data matching...
|
by: Ian Anderson |
last post by:
Hello there,
SO i have the followign VB code in my continuous form...
'Purpose: This module illustrates how to create a search form, _
where the user can enter as many or few...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |