Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems building query from form

Status
Not open for further replies.

Delindan

MIS
May 27, 2011
203
US
I'm trying to build a multi selection filter form using faq181-5497. I believe I have my 3 list boxes on the form built correctly. They are list boxes that have multi select enabled, are visible, and are enabled. Each box has a Where= statement in the Tag property. I will post how I am trying to use the function:

Set DB = CurrentDb
strSQL = BuildWhere(Me)
Set qdf = DB.CreateQueryDef("", strSQL)
For Each prm In qdf.Parameters
prm.Value = Eval(prm.Name)
Next prm
Set RSBudget = qdf.OpenRecordset

Where BuildWhere(Me) is the function provided. I have gotten both a 3319 error and a 3066 error depending on how many of the list boxes I use. Any ideas?
 
That FAQ requires a fair amount of work with the tag properties which you haven't provided.

Learn how to use Debug.Print, MsgBox(), and set breakpoints. Try:
Code:
   Set DB = CurrentDb
    strSQL = BuildWhere(Me)
    [b][blue]Debug.Print strSQL[/blue][/b]
        Set qdf = DB.CreateQueryDef("", strSQL)
        For Each prm In qdf.Parameters
        prm.Value = Eval(prm.Name)
        Next prm
        Set RSBudget = qdf.OpenRecordset

Duane
Hook'D on Access
MS Access MVP
 

Could you share what the [blue]BLUE[/blue] line of code gives you in the Immediate Window:
Code:
strSQL = BuildWhere(Me)[blue]
Debug.Print strSQL[/blue]
Set qdf = DB.CreateQueryDef("", strSQL)

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top