473,395 Members | 1,941 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.

Date parameter not getting passed from form to query

beacon
579 512MB
Hi everybody,

I have a form for every report in this latest database that I use to accept parameters for the underlying query. On the form, I have a command button that launches a calendar module that I got from the Microsoft Office Access 2003: Inside and Out book by John Viescas. The calendar mod basically opens a dialog form, accepts the date chosen by the user, and passes it back to the original form.

When I submit the form, the date doesn't get passed to the underlying query or the expression in the textbox for the report. However, if I manually type the date into the textbox on the form it works fine in both places. I thought that maybe it was because I didn't have a date format on the textboxes, but that didn't help.

Probably should mention that the parameters are primarily for a discharge date range and then the two expressions I mentioned above that are supposed to accept the date parameter from the form.

Form:
Expand|Select|Wrap|Line Numbers
  1. Textbox #1: BeginningDate
  2. Textbox #2: EndingDate
  3.  
Query:
Expand|Select|Wrap|Line Numbers
  1. DischargeDate: Between [Forms]![frmReportDefinition]![BeginningDate] And [Forms]![frmReportDefinition]![EndingDate]
  2. BeginningDate: [Forms]![frmReportDefinition]![BeginningDate]
  3. EndingDate: [Forms]![frmReportDefinition]![EndingDate]
  4.  
Report:
Expand|Select|Wrap|Line Numbers
  1. Textbox #1 Name: Title
  2. Textbox #1 Control Source: ="Report Definition" & Chr(13) & Chr(10) & [BeginningDate] & " to " & [EndingDate]
  3.  
If this is vague or confusing, please let me know and I'll be glad to provide more details.

Thanks,
beacon
Feb 15 '10 #1
3 3900
beacon
579 512MB
Well, I found a solution, but still don't really understand why what I did originally didn't work. Sorry for posting and then finding my own answer like 5 minutes later...

I went into the query and added the CStr() function around the expression and it worked.

I'm still interested in understanding why this happened and I was forced to use a conversion function to get it to work instead of using what I had originally, so please feel free to comment.

Thanks,
beacon
Feb 15 '10 #2
mshmyob
904 Expert 512MB
Dates in Access have to wrapped in the '#' symbol.

cheers,
Feb 15 '10 #3
beacon
579 512MB
Which line above would I wrap the '#' sign around? I tried using it in the query, but received a syntax error if I placed it around the entire [Forms]![ReportDef]![BeginningDate] and when I placed them around just [BeginningDate] ([Forms]![ReportDef]!#[BeginningDate]#).

The user won't know (and probably couldn't be trusted) to put '#' around his/her date on the form, and the calendar mod returns the a date.
Feb 15 '10 #4

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

Similar topics

5
by: Belinda | last post by:
Hello All I have the following test.asp page which needs one parameter querystr but my querystr is a very long string value. When I send a long value the query string is getting truncated after...
3
by: MX1 | last post by:
I'm ready to pull the hair out of my head. I have a query with a couple of parameters that I want to get from combo boxes on a form. One parameter is a date with a dynamically calculated year and...
2
by: Tony | last post by:
Hello everyone, Okay so here is my pickle! I have a field called ARCH_DATE within a table which has a date stored like "9/1/2004 23:50:00". What I would like to do is create a date range which...
3
by: manning_news | last post by:
Using A2K. I've been asked to modify a report currently requiring only one date parameter to now accept a date range. The main report has 2 subreports and is not bound to a table or query. The...
3
by: bcaponet | last post by:
I have a form where a user enters a date that I will then base a query on. In the past, I have simply placed Forms!! into the criteria for a query and it runs as long as the form is open. The...
2
by: Julie Wardlow | last post by:
Help! I am calculating a future date using the DateAdd function in a query (the calculation also involves an IIf statement), and have managed to get this formula to produce the required result....
11
by: Dixie | last post by:
How can I programatically, take some Date/Time fields present in a table in the current database and change their type to text? dixie
13
by: Alan | last post by:
Hi Have asked before elsewhere but think I will have to rephrase the question. Using MS Access, what's the best way of tackling dates if I want to list all say; birthdays/birthdates in a date...
7
by: Richiep | last post by:
I am trying to get a UK format date of dd/mm/yyyy. Why does the following subroutine not return a valid date in a web form? The date returned is #12:00:00 AM# but the date I entered into the...
3
by: Fred's | last post by:
Hi Folks, I have a report which the record source is a query name: Query3 and in my Query3 I have this parameter "between And ". Therefore, when I open my report, it will ask for a Start Date...
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: 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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.