473,396 Members | 1,914 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,396 software developers and data experts.

Run Time Error 3075

3
I have a form that I want to show invoices in a date range. When clicking on the button I get the following error:

Run Time Error 3075 Syntax error (missing operator) in query expression '(Invoice Date Between #08/27/2008 And #08/27/2008#)'

Here is the code associated w/the error:

Dim strReport As String 'Name of report to open.
Dim strField As String 'Name of your date field.
Dim strWhere As String 'Where condition for OpenReport.
Const conDateFormat = "\#mm\/dd\/yyyy\#"

strReport = "SDInvoice"
strField = "Invoice Date"

If IsNull(Me.txtStartDate) Then
If Not IsNull(Me.txtEndDate) Then 'End date, but no start.
strWhere = strField & " <= " & Format(Me.txtEndDate, conDateFormat)
End If
Else
If IsNull(Me.txtEndDate) Then 'Start date, but no End.
strWhere = strField & " >= " & Format(Me.txtStartDate, conDateFormat)
Else 'Both start and end dates.
strWhere = strField & " Between " & Format(Me.txtStartDate, conDateFormat) _
& " And " & Format(Me.txtEndDate, conDateFormat)
End If
End If

' Debug.Print strWhere 'For debugging purposes only.
DoCmd.OpenReport strReport, acViewPreview, , strWhere

What am I missing?
Aug 28 '08 #1
5 2383
QVeen72
1,445 Expert 1GB
Hi,

After building the Where Condition,
Closing "#" for From date is missing..
#08/27/2008 And #08/27/2008#

Keep a BreakPoint at the beginning and check..

REgards
Veena
Aug 29 '08 #2
QVeen72
1,445 Expert 1GB
Hi,

I guess, there is one more problem...

Your field name is "Invoice Date"
there is a Space in the field name, so you need to Enclose Between
SQUARE BRACKETS

Expand|Select|Wrap|Line Numbers
  1. "Select * From MyTable Where [Invoice Date] Between #08-08-2008#  And #08-08-2008#"
  2.  
Regards
Veena
Aug 29 '08 #3
Ledo
3
Thanks for you reply. I have reworked the strWhere condition but now receive a "Run-time error 2427. You have entered an expression that has no value" and moves to the VBA code I have set in the "SDInvoice" report, and cannot figure out why? Any insight would appreciated.
Sep 2 '08 #4
Helo,

I think your problem is the Text mising in the text component.

strWhere = strField & " Between " & Format(Me.txtStartDate, conDateFormat) _
& " And " & Format(Me.txtEndDate, conDateFormat)


If Me.txtSTartDate is refered to a textbox you need to add .Text like this

me.txtStartDate.Text and the same at me.txtEndDate.Text

I hope this help
Sep 3 '08 #5
Ledo
3
That did it, thanks to everyone for all your help!
Sep 3 '08 #6

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

Similar topics

3
by: khan | last post by:
getting, error, 3075 Syntax Error (Missing Operator) in query expression '8WHERE .=1' Dim TotalQty As Integer TotalQty = DLookup("", "", "=" & Forms!!)
1
by: Mike N. | last post by:
Hello- I have a normal application split into a frontend and backend. The tables are in the backend. All tables open correctly from the backend. When in the OBJECTS window (F11) in the front...
3
by: william | last post by:
Hello Everyone, I'm using Access 2000. I entered the following code to do some data validation, however it is not working. I'm trying to ensure that the user cannot enter a duplicate inspection...
1
by: Jozef | last post by:
Hello, I'm installing a package created with Office XP developers edition Packaging Wizard. I get an "Error 3075" Cannot I've looked at the Microsoft Website and this seems to be an Access 97...
2
by: jr | last post by:
Hello everyone! I am new to this sort of postings so I'm not even sure if this is the correct place to start. Anyway, I would realy appreciate any help. I have a some VBA code that works quite...
6
by: Nadnerb78 | last post by:
Please see code below: strSQL = "SELECT Max(EntryType) AS MaxOfEntryType " & _ "FROM tblForecastData GROUP BY BusinessLine, , Week " & _ "HAVING ((()='" & xx & "') AND ((Week)=" & xx & ")) " ...
1
by: kickergirl | last post by:
I recently created a database in Access 2000 that has been distributed to multiple people using various versions of Access. Each person is using it as a standalone database. The database has...
22
by: ozgenaga | last post by:
Hi guys, I am trying to insert new data records to a table but I am getting a run-time error. I would appreciate any kind of help. Here is my code: Sub WorstQueryEver() Dim db As...
4
by: srinathvs | last post by:
Hi, I have an access db that I am trying to query from a vb6 program. I've the following code: Dim sSQLQuery As String sSQLQuery = "SELECT * FROM TblData WHERE ID = " & Chr(39) & ID &...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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...
0
Oralloy
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,...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.