Re: Updating form based on 2 fields.
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Mon, 19 Jun 2006 23:03:04 +0800
strPara = "([Query_by_Customer_and_Date]![Date] Between """ & _
txtStartDate & """ And """ & txtEndDate & _
""") AND ([Query_by_Customer_and_Date]![Customer] =""" & _
cmbCustName & """)"
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"C_Ascheman" <CAscheman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7DA4973A-D027-4F4D-991E-907E5C34D765@xxxxxxxxxxxxxxxx
Sorry Allen I should have clarified more. Everything is set to text. The
dates are text with the short date format. This bit of code:
strPara = "[Query_by_Customer_and_Date]![Date] Between '" & txtStartDate &
"' And '" & txtEndDate & "'"
Works fine. Its when I add this code to the end of it:
And '"[Query_by_Customer_and_Date]![Customer]
Like '" & cmbCustName & "'"
That is gives me and end of statement error. I am already using the first
part of the code in my program, and that part tests perfectly. Its when I
try
adding the query for the Customer name that it stops wanting to work. I
kept
everything in text format to simplify things for myself since I am in
essence
learning this as I go along .. plus the fact that my boss wants the
program
up an running yesterday it's helps me to save time to keep everything as
text. At a later date I can recode it all to properly handle dates, and
such.
Right now though text format is quicker, and easier to learn. Thanks for
you
help so far, any more suggestions or ideas are appreciated.
C_Ascheman
"Allen Browne" wrote:
Try using # as the delimiter around the dates, and using the quote
delimiter
only around the literal value to match the Customer field to:
strPara = "([Query_by_Customer_and_Date]![Date] Between #" & _
txtStartDate & "# And #" & txtEndDate & _
"#) AND ([Query_by_Customer_and_Date]![Customer] ='" & _
cmbCustName & "')"
That field named Date will cause you problems in some contexts (probably
not
this one.)
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"C_Ascheman" <CAscheman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A1F60520-372D-4744-BBFD-86C527352448@xxxxxxxxxxxxxxxx
Here is the code I have:
strPara = "[Query_by_Customer_and_Date]![Date] Between '" &
txtStartDate &
"' And '" & txtEndDate & "' And
'"[Query_by_Customer_and_Date]![Customer]
Like '" & cmbCustName & "'"
The problem is its giving me an end of statement error before the final
And.
With this final bit of code my program may finally be done (I hope).
This
is
more advanced programming then I am used to, or was ever taught in
school.
So
please forgive me for my constant, and what may appear repetitive
questions.
For the life of me I cannot figure out why it is throwing up an end of
statement there. I have txtStartDate, txtEndDate, and cmbCustName on a
form.
When the user inputs data into these fields, and clicks on a button it
runs
these parameters through a query called Query_by_Customer_and_Date and
opens
the form Customer_and_Date_Weekly_Form. Any help in straightening out
this
bit of code is greatly appreciated as always.
C_Ascheman
.
- Follow-Ups:
- Re: Updating form based on 2 fields.
- From: C_Ascheman
- Re: Updating form based on 2 fields.
- References:
- Re: Updating form based on 2 fields.
- From: Allen Browne
- Re: Updating form based on 2 fields.
- From: C_Ascheman
- Re: Updating form based on 2 fields.
- Prev by Date: Re: Updating form based on 2 fields.
- Next by Date: Re: Referencing control in subform from subform's subform
- Previous by thread: Re: Updating form based on 2 fields.
- Next by thread: Re: Updating form based on 2 fields.
- Index(es):