date formatting in query string

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



hi all,

I'm trying to set up a query that uses the month chosen from a
combobox.
Let's say I choose the month "march", that is listindex 2 in the combo
+ 1 = 3 for march.
Now I want all docs with month march, so Month(document_date) = 3.

The following code returns an syntax error

.... AND Month(Document_Date)=" & Str(cboMonth.ListIndex + 1)

p.s. Document_Date is a fieldname in a database table, like
"12-03-2003".

Regards
Marco

.



Relevant Pages

  • RE: ComboBox Filled by Query
    ... Yes you can fill the combobox with a query. ... Dim db as Database ... Dim rs as Recordset ...
    (microsoft.public.excel.programming)
  • Re: Combo dropdown list box (on Switchboard)-How to open a specific row?
    ... This query's dropdown is on the Switchboard (if ... Query may narrow database records' view to 3 or 4 columns w/in the ... Ify ou want to change the controlsource of your combobox on the fly, ...
    (comp.databases.ms-access)
  • Re: Getting a list of forms in another Access DB
    ... One way would be to create a query that reads the MSysObjects in the other ... database and use that as the RowSource for your combobox. ...
    (microsoft.public.access.modulesdaovba)
  • Re: date formatting in query string
    ... I'm trying to set up a query that uses the month chosen from a ... combobox. ... p.s. Document_Date is a fieldname in a database table, ... (ADO, DAO, RDO,...) ...
    (microsoft.public.vb.general.discussion)
  • Re: Parameter query
    ... you are welcome to compact your database and mail it to me to have a look. ... Darhl Thomason wrote: ... Note that what displays in the ComboBox may not be the value of the ComboBox ... (that is passed to the Query). ...
    (microsoft.public.access.queries)