473,395 Members | 1,581 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Syntax error(missing operator) in query expression

2
The problem is fairly complex. I have a table where I can add records. These records have several parts. Each record consists of ID, Date, Train Number and many more. I have a form where I can add records. This form has two pages. One for adding records ( this part works fine ) and then I have another form where I can search records by filtering. The filtering happens by using an options group with different options button. I added a button to this page to display the filtered records on another form. When I filter by ID everything works, when I filter by Date it works too so I thought the other options would work fine too, but if I filter by Train number it doesn't work. This is the fault message I get: Syntax error( misssing operator ) in query expression
'Train Number = Forms![Faults_Form]![Firsttrainnumber]' I have no idea why it doesn't work. Lets finish by adding some code. The date part works but the train number part doesn't.

Private Sub Search_Workorder_Button_Click()
On Error GoTo Err_Search_Workorder_Button_Click


Dim Filtervoorwaarde



Select Case Me![Filter_options_Frame]
Case 1

DoCmd.OpenForm "Faults_Overview_Form"


Case 2

' Als besturingselement blanco is, bericht weergeven.
If IsNull(Forms![Faults_Form]![Date1]) Then
strBer = "Insert a date in the textbox."
intStijl = vbOKOnly
strTitel = "Date selection"
MsgBox strBer, intStijl, strTitel
Forms![Faults_Form]![Date1].SetFocus
Else
Filtervoorwaarde = "Date = Forms![Faults_Form]![Date1]"
DoCmd.OpenForm "Faults_Overview_Form", , , Filtervoorwaarde


End If
Case 3

If IsNull(Forms![Faults_Form]![Firsttrainnumber]) Then
strBer = "Insert a train number (101-120) in the textbox."
intStijl = vbOKOnly
strTitel = "Train selection"
MsgBox strBer, intStijl, strTitel
Forms![Faults_Form]![Firsttrainnumber].SetFocus
Else
Filtervoorwaarde = "Train Number = Forms![Faults_Form]![Firsttrainnumber]"
DoCmd.OpenForm "Faults_Overview_Form", , , Filtervoorwaarde


End If

case 1 and 2 are working but case 3 is not.

Thanks
Mar 17 '10 #1
2 2274
MikeTheBike
639 Expert 512MB
Hi

Just one possible suggestion, you could try this:

Filtervoorwaarde = "[Train Number] = Forms![Faults_Form]![Firsttrainnumber]"

It's not a good idea to have spaces in fierld names!


MTB
Mar 19 '10 #2
Lieven
2
Thanks Mike,

good tip!! I changed it and it seems to work now.
Mar 19 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: alexz | last post by:
valuA = (request.form("toadd")) If valuA = "" then SQL = "UPDATE CourseReg SET attended='Active' WHERE ID IN("&request.form("toadd")&")" Set RS = MyConn.Execute(SQL) End If MyConn.Close Set...
29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
4
by: dcarson | last post by:
I've read about this error in several other discussions, but still can't seem to pinpoint the problem with my code. Everything seemed to be working fine for some time, but it now tends to bomb out...
3
by: Lumpierbritches | last post by:
Syntax Error (missing operator) in query expression =BLANK'S MOLLIE-PRINCE BRUISER-3/14/2004-03 AnimalID is correct. I'm trying to open with a command button or double click the frmAnimal from a...
4
by: khan | last post by:
getting, error, 3075 Syntax Error (Missing Operator) in query expression '8WHERE .=1' Dim TotalQty As Integer TotalQty = DLookup("", "", "=" & Forms!!)
4
by: thebarefootnation | last post by:
Hi I have the following error message "Syntax Error (missing operator) in query expression" occurring when I am trying to update combo box within a form. My code is: Dim strSQL As String
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.