473,405 Members | 2,176 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,405 software developers and data experts.

Problem with unbound form fields for search / building query in VBA

Hi, I am using unbound text boxes in the header of a form to allow the user to search on a number of fields. I am using VBA to build a query string based on these and it has been fine when comparing text fields on the main form but I have run in to trouble comparing date/time fields on a subform.
The subform is called Activity and I am comparing to the date/time field ActivityStartDate.

This is the code:
Expand|Select|Wrap|Line Numbers
  1. If Not IsNull(Me.searchFromDate) Then
  2.         varFromDate = Format(Me.searchFromDate, "mm/dd/yyyy hh:nn:ss")
  3.         strWhere = strWhere & "([Activity].Form![ActivityStartDate] >= " & varFromDate & ") AND "
  4.         End If
  5.  
(There is code later on to remove the trailing AND if it is at the end)

This gives me the error:
Run-time error 3075 Syntax error (missing operator) in query expression
'([Activity].Form![ActivityStartDate] >= 02/12/2008 00:00:00)'

I've tried printing ActivityStartDate and it's exactly the same date and format.
As the operator does seem to be there I can't see why I get this error message - can anyone shed any light?

Using Access 2007 on Windows Vista.

Thanks in advance
Craig
Mar 11 '08 #1
1 1855
Sorry, just needed to format the date fields with the # (hash) symbols either side. Noob mistake, my bad.
Mar 13 '08 #2

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

Similar topics

6
by: William Bradley | last post by:
I have a production table and its accompanying form. There can be up to ten ingredients in what is produced. The ingredients are obtained from the incoming goods table which supplies the two...
4
by: Lumpierbritches | last post by:
Thank you once again for any and all assistance. I'm building an application that's getting quite bulky due to the number of forms, macros and procedures. I was wondering if there's a way to use 1...
1
by: huela | last post by:
Somehow i have to display the recordset in unbound form When i use the following display the data in recordset to unbound form. I have a question: i can only display the last record data, all...
3
by: dskillingstad | last post by:
I'd appreciate any help I can get. I'm not sure what I'm doing wrong, but.... I've searched these groups for some solutions but no luck. I have an unbound form (frmSearch), with several unbound...
3
by: MLH | last post by:
I have a form, bound to a query. Its RecordSource property is a query named frmEnterLienAmounts. The form has a few bound controls and some unbound controls. The unbound controls are calculated...
1
by: bcreighton | last post by:
I have created a bound subform on an unbound masterform linked together with a common field (A store's identification number) using an unbound combobox on the masterform and an invisible field on...
2
by: Damon Cherne | last post by:
Here is my issue. I have created a form called “Search” that has several unbound combo boxes, one for each of the attribute that match a column in the Table . Each combo box has input from a...
0
by: Kaur | last post by:
Hi, I am having problem trying to go to same record when I close 3rd form. I have a form called frmDepartment. This form has a list box that displays all the departments. Clicking on one of the...
1
by: lupo666 | last post by:
Hi, I have a database with only one table containing the following fields: ID (primary key, auto-counter), Client (Text), Internal_ID (Text), Window (Y/N), Lock(Y/N), LED (Y/N) What I'm...
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
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
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.