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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter Query with 5 listboxes

Status
Not open for further replies.

dvenkat

Programmer
May 13, 2002
11
US
Hi-

I am developing a query (parameter) with 5 list boxes. I am using the following code (see below) to retrieve records from the query based on the user options/ choices. However I get this error message when I run the query.

Error Message:
Run-time error '3075'
Syntax error (missing operator) in query expression '([Assy] In()) AND ([PTI2] In()) AND ([PkgCd] In()) AND ([ProdLine] In ()) AND ([CycleMonth] In())

This error message is when I select nothing. If I select something, I get the same error message but with that selection in the appropriate field - e.g. Syntax error...................AND ([PTI2] In("JD")) AND ([PkgCd] In("0051"))...........

In my query design view, I try to insert the following but it vanishes when the query is executed.
Expr1: Nz([PTI2])
Criteria: Like ("*")
Similarly I have the same thing for other list boxes except CycleMonth which is a date field. I left that blank.

But as I said, when I try to execute the query from the form, I get the error message and when I open to see the query all my expressions are gone.


CAN ANYONE HELP ME WITH THIS. I HAVE BEEN TRYING FOR 2 WEEKS BUT GOING NOWHERE. I AM NEW TO ACCESS AND ACCESS BASIC (VB). ANY HELP WILL BE GREATLY APPRECIATED.

Thanks........

----------------------------------------------------------
Here is my code:

Sub RunTest_Click()

Dim AssyDB
Dim Q

Dim Criteria1 As String
Dim Criteria2 As String
Dim Criteria3 As String
Dim Criteria4 As String
Dim Criteria5 As String

Dim ctl1 As Control
Dim ctl2 As Control
Dim ctl3 As Control
Dim ctl4 As Control
Dim ctl5 As Control

Dim Itm1 As Variant
Dim Itm2 As Variant
Dim Itm3 As Variant
Dim Itm4 As Variant
Dim Itm5 As Variant

Set ctl1 = [Forms]![frm_main]![lstassy]
Set ctl2 = [Forms]![frm_main]![lstpti2]
Set ctl3 = [Forms]![frm_main]![lstpkgcd]
Set ctl4 = [Forms]![frm_main]![lstprodline]
Set ctl5 = [Forms]![frm_main]![lstcycmon]

For Each Itm1 In ctl1.ItemsSelected
If Len(Criteria1) = 0 Then
Criteria1 = Chr(34) & ctl1.ItemData(Itm1) & Chr(34)
Else
Criteria1 = Criteria1 & "," & Chr(34) & ctl1.ItemData(Itm1) & Chr(34)
End If
Next Itm1

For Each Itm2 In ctl2.ItemsSelected
If Len(Criteria2) = 0 Then
Criteria2 = Chr(34) & ctl2.ItemData(Itm2) & Chr(34)
Else
Criteria2 = Criteria2 & "," & Chr(34) & ctl2.ItemData(Itm2) & Chr(34)
End If
Next Itm2

For Each Itm3 In ctl3.ItemsSelected
If Len(Criteria3) = 0 Then
Criteria3 = Chr(34) & ctl3.ItemData(Itm3) & Chr(34)
Else
Criteria3 = Criteria3 & "," & Chr(34) & ctl3.ItemData(Itm3) & Chr(34)
End If
Next Itm3

For Each Itm4 In ctl4.ItemsSelected
If Len(Criteria4) = 0 Then
Criteria4 = Chr(34) & ctl4.ItemData(Itm4) & Chr(34)
Else
Criteria4 = Criteria4 & "," & Chr(34) & ctl4.ItemData(Itm4) & Chr(34)
End If
Next Itm4

For Each Itm5 In ctl5.ItemsSelected
If Len(Criteria5) = 0 Then
Criteria5 = Chr(34) & ctl5.ItemData(Itm5) & Chr(34)
Else
Criteria5 = Criteria5 & "," & Chr(34) & ctl5.ItemData(Itm5) & Chr(34)
End If
Next Itm5

Set AssyDB = CurrentDb()
Set Q = AssyDB.QueryDefs("qry_ddprmrsactuals")
'If cbodatatype.Text = "ALL" Then
If (ctl5.Selected(0) = True And ctl4.Selected(0) = True And ctl3.Selected(0) = True And ctl2.Selected(0) = True And ctl1.Selected(0) = True) Then
Q.SQL = "SELECT tbl_ddpr_mrs_actuals.Assy, tbl_ddpr_mrs_actuals.Test, tbl_ddpr_mrs_actuals.PTI2, tbl_ddpr_mrs_actuals.PkgCd, tbl_ddpr_mrs_actuals.PkgDesc, tbl_ddpr_mrs_actuals.ProdLine, tbl_ddpr_mrs_actuals.TestPlatform, tbl_ddpr_mrs_actuals.CycleMonth, tbl_ddpr_mrs_actuals.PlanMonth, tbl_ddpr_mrs_actuals.DataType, tbl_ddpr_mrs_actuals.Outs FROM tbl_ddpr_mrs_actuals WHERE (Nz([Assy]) Like(" & Criteria1 & ")) " & _
"AND (Nz([PTI2]) Like(" & Criteria2 & ")) AND (Nz([PkgCd]) Like(" & Criteria3 & ")) AND (Nz([ProdLine]) Like(" & Criteria4 & ")) AND (Nz([CycleMonth]) Like(" & Criteria5 & "));"
ElseIf (ctl5.Selected(0) = True And ctl4.Selected(0) = True And ctl3.Selected(0) = True And ctl2.Selected(0) = True) Then
Q.SQL = "SELECT tbl_ddpr_mrs_actuals.Assy, tbl_ddpr_mrs_actuals.Test, tbl_ddpr_mrs_actuals.PTI2, tbl_ddpr_mrs_actuals.PkgCd, tbl_ddpr_mrs_actuals.PkgDesc, tbl_ddpr_mrs_actuals.ProdLine, tbl_ddpr_mrs_actuals.TestPlatform, tbl_ddpr_mrs_actuals.CycleMonth, tbl_ddpr_mrs_actuals.PlanMonth, tbl_ddpr_mrs_actuals.DataType, tbl_ddpr_mrs_actuals.Outs FROM tbl_ddpr_mrs_actuals WHERE (Nz([Assy]) Like(" & Criteria1 & ")) " & _
"AND (Nz([PTI2]) Like(" & Criteria2 & ")) AND (Nz([PkgCd]) Like(" & Criteria3 & ")) AND (Nz([ProdLine]) Like(" & Criteria4 & ")) AND (Nz([CycleMonth]) Like(" & Criteria5 & "));"
ElseIf (ctl5.Selected(0) = True And ctl4.Selected(0) = True And ctl3.Selected(0) = True And ctl1.Selected(0) = True) Then
Q.SQL = "SELECT tbl_ddpr_mrs_actuals.Assy, tbl_ddpr_mrs_actuals.Test, tbl_ddpr_mrs_actuals.PTI2, tbl_ddpr_mrs_actuals.PkgCd, tbl_ddpr_mrs_actuals.PkgDesc, tbl_ddpr_mrs_actuals.ProdLine, tbl_ddpr_mrs_actuals.TestPlatform, tbl_ddpr_mrs_actuals.CycleMonth, tbl_ddpr_mrs_actuals.PlanMonth, tbl_ddpr_mrs_actuals.DataType, tbl_ddpr_mrs_actuals.Outs FROM tbl_ddpr_mrs_actuals WHERE (Nz([Assy]) Like(" & Criteria1 & ")) " & _
"AND (Nz([PTI2]) Like(" & Criteria2 & ")) AND (Nz([PkgCd]) Like(" & Criteria3 & ")) AND (Nz([ProdLine]) Like(" & Criteria4 & ")) AND (Nz([CycleMonth]) Like(" & Criteria5 & "));"
ElseIf (ctl5.Selected(0) = True And ctl4.Selected(0) = True And ctl3.Selected(0) = True) Then
Q.SQL = "SELECT tbl_ddpr_mrs_actuals.Assy, tbl_ddpr_mrs_actuals.Test, tbl_ddpr_mrs_actuals.PTI2, tbl_ddpr_mrs_actuals.PkgCd, tbl_ddpr_mrs_actuals.PkgDesc, tbl_ddpr_mrs_actuals.ProdLine, tbl_ddpr_mrs_actuals.TestPlatform, tbl_ddpr_mrs_actuals.CycleMonth, tbl_ddpr_mrs_actuals.PlanMonth, tbl_ddpr_mrs_actuals.DataType, tbl_ddpr_mrs_actuals.Outs FROM tbl_ddpr_mrs_actuals WHERE (Nz([Assy]) Like(" & Criteria1 & ")) " & _
"AND (Nz([PTI2]) Like(" & Criteria2 & ")) AND (Nz([PkgCd]) Like(" & Criteria3 & ")) AND (Nz([ProdLine]) Like(" & Criteria4 & ")) AND (Nz([CycleMonth]) Like(" & Criteria5 & "));"
ElseIf (ctl5.Selected(0) = True And ctl4.Selected(0) = True And ctl2.Selected(0) = True) Then
Q.SQL = "SELECT tbl_ddpr_mrs_actuals.Assy, tbl_ddpr_mrs_actuals.Test, tbl_ddpr_mrs_actuals.PTI2, tbl_ddpr_mrs_actuals.PkgCd, tbl_ddpr_mrs_actuals.PkgDesc, tbl_ddpr_mrs_actuals.ProdLine, tbl_ddpr_mrs_actuals.TestPlatform, tbl_ddpr_mrs_actuals.CycleMonth, tbl_ddpr_mrs_actuals.PlanMonth, tbl_ddpr_mrs_actuals.DataType, tbl_ddpr_mrs_actuals.Outs FROM tbl_ddpr_mrs_actuals WHERE (Nz([Assy]) Like(" & Criteria1 & ")) " & _
"AND (Nz([PTI2]) Like(" & Criteria2 & ")) AND (Nz([PkgCd]) Like(" & Criteria3 & ")) AND (Nz([ProdLine]) Like(" & Criteria4 & ")) AND (Nz([CycleMonth]) Like(" & Criteria5 & "));"
ElseIf (ctl5.Selected(0) = True And ctl3.Selected(0) = True And ctl2.Selected(0) = True) Then
Q.SQL = "SELECT tbl_ddpr_mrs_actuals.Assy, tbl_ddpr_mrs_actuals.Test, tbl_ddpr_mrs_actuals.PTI2, tbl_ddpr_mrs_actuals.PkgCd, tbl_ddpr_mrs_actuals.PkgDesc, tbl_ddpr_mrs_actuals.ProdLine, tbl_ddpr_mrs_actuals.TestPlatform, tbl_ddpr_mrs_actuals.CycleMonth, tbl_ddpr_mrs_actuals.PlanMonth, tbl_ddpr_mrs_actuals.DataType, tbl_ddpr_mrs_actuals.Outs FROM tbl_ddpr_mrs_actuals WHERE (Nz([Assy]) Like(" & Criteria1 & ")) " & _
"AND (Nz([PTI2]) Like(" & Criteria2 & ")) AND (Nz([PkgCd]) Like(" & Criteria3 & ")) AND (Nz([ProdLine]) Like(" & Criteria4 & ")) AND (Nz([CycleMonth]) Like(" & Criteria5 & "));"
ElseIf (ctl5.Selected(0) = True And ctl4.Selected(0) = True And ctl2.Selected(0) = True And ctl1.Selected(0) = True) Then
Q.SQL = "SELECT tbl_ddpr_mrs_actuals.Assy, tbl_ddpr_mrs_actuals.Test, tbl_ddpr_mrs_actuals.PTI2, tbl_ddpr_mrs_actuals.PkgCd, tbl_ddpr_mrs_actuals.PkgDesc, tbl_ddpr_mrs_actuals.ProdLine, tbl_ddpr_mrs_actuals.TestPlatform, tbl_ddpr_mrs_actuals.CycleMonth, tbl_ddpr_mrs_actuals.PlanMonth, tbl_ddpr_mrs_actuals.DataType, tbl_ddpr_mrs_actuals.Outs FROM tbl_ddpr_mrs_actuals WHERE (Nz([Assy]) Like(" & Criteria1 & ")) " & _
"AND (Nz([PTI2]) Like(" & Criteria2 & ")) AND (Nz([PkgCd]) Like(" & Criteria3 & ")) AND (Nz([ProdLine]) Like(" & Criteria4 & ")) AND (Nz([CycleMonth]) Like(" & Criteria5 & "));"
ElseIf (ctl5.Selected(0) = True And ctl3.Selected(0) = True And ctl2.Selected(0) = True And ctl1.Selected(0) = True) Then
Q.SQL = "SELECT tbl_ddpr_mrs_actuals.Assy, tbl_ddpr_mrs_actuals.Test, tbl_ddpr_mrs_actuals.PTI2, tbl_ddpr_mrs_actuals.PkgCd, tbl_ddpr_mrs_actuals.PkgDesc, tbl_ddpr_mrs_actuals.ProdLine, tbl_ddpr_mrs_actuals.TestPlatform, tbl_ddpr_mrs_actuals.CycleMonth, tbl_ddpr_mrs_actuals.PlanMonth, tbl_ddpr_mrs_actuals.DataType, tbl_ddpr_mrs_actuals.Outs FROM tbl_ddpr_mrs_actuals WHERE (Nz([Assy]) Like(" & Criteria1 & ")) " & _
"AND (Nz([PTI2]) Like(" & Criteria2 & ")) AND (Nz([PkgCd]) Like(" & Criteria3 & ")) AND (Nz([ProdLine]) Like(" & Criteria4 & ")) AND (Nz([CycleMonth]) Like(" & Criteria5 & "));"
ElseIf (ctl5.Selected(0) = True And ctl4.Selected(0) = True And ctl1.Selected(0) = True) Then
Q.SQL = "SELECT tbl_ddpr_mrs_actuals.Assy, tbl_ddpr_mrs_actuals.Test, tbl_ddpr_mrs_actuals.PTI2, tbl_ddpr_mrs_actuals.PkgCd, tbl_ddpr_mrs_actuals.PkgDesc, tbl_ddpr_mrs_actuals.ProdLine, tbl_ddpr_mrs_actuals.TestPlatform, tbl_ddpr_mrs_actuals.CycleMonth, tbl_ddpr_mrs_actuals.PlanMonth, tbl_ddpr_mrs_actuals.DataType, tbl_ddpr_mrs_actuals.Outs FROM tbl_ddpr_mrs_actuals WHERE (Nz([Assy]) Like(" & Criteria1 & ")) " & _
"AND (Nz([PTI2]) Like(" & Criteria2 & ")) AND (Nz([PkgCd]) Like(" & Criteria3 & ")) AND (Nz([ProdLine]) Like(" & Criteria4 & ")) AND (Nz([CycleMonth]) Like(" & Criteria5 & "));"
ElseIf (ctl5.Selected(0) = True And ctl3.Selected(0) = True And ctl1.Selected(0) = True) Then
Q.SQL = "SELECT tbl_ddpr_mrs_actuals.Assy, tbl_ddpr_mrs_actuals.Test, tbl_ddpr_mrs_actuals.PTI2, tbl_ddpr_mrs_actuals.PkgCd, tbl_ddpr_mrs_actuals.PkgDesc, tbl_ddpr_mrs_actuals.ProdLine, tbl_ddpr_mrs_actuals.TestPlatform, tbl_ddpr_mrs_actuals.CycleMonth, tbl_ddpr_mrs_actuals.PlanMonth, tbl_ddpr_mrs_actuals.DataType, tbl_ddpr_mrs_actuals.Outs FROM tbl_ddpr_mrs_actuals WHERE (Nz([Assy]) Like(" & Criteria1 & ")) " & _
"AND (Nz([PTI2]) Like(" & Criteria2 & ")) AND (Nz([PkgCd]) Like(" & Criteria3 & ")) AND (Nz([ProdLine]) Like(" & Criteria4 & ")) AND (Nz([CycleMonth]) Like(" & Criteria5 & "));"
ElseIf (ctl5.Selected(0) = True And ctl2.Selected(0) = True And ctl1.Selected(0) = True) Then
Q.SQL = "SELECT tbl_ddpr_mrs_actuals.Assy, tbl_ddpr_mrs_actuals.Test, tbl_ddpr_mrs_actuals.PTI2, tbl_ddpr_mrs_actuals.PkgCd, tbl_ddpr_mrs_actuals.PkgDesc, tbl_ddpr_mrs_actuals.ProdLine, tbl_ddpr_mrs_actuals.TestPlatform, tbl_ddpr_mrs_actuals.CycleMonth, tbl_ddpr_mrs_actuals.PlanMonth, tbl_ddpr_mrs_actuals.DataType, tbl_ddpr_mrs_actuals.Outs FROM tbl_ddpr_mrs_actuals WHERE (Nz([Assy]) Like(" & Criteria1 & ")) " & _
"AND (Nz([PTI2]) Like(" & Criteria2 & ")) AND (Nz([PkgCd]) Like(" & Criteria3 & ")) AND (Nz([ProdLine]) Like(" & Criteria4 & ")) AND (Nz([CycleMonth]) Like(" & Criteria5 & "));"
ElseIf (ctl5.Selected(0) = True And ctl4.Selected(0) = True) Then
Q.SQL = "SELECT tbl_ddpr_mrs_actuals.Assy, tbl_ddpr_mrs_actuals.Test, tbl_ddpr_mrs_actuals.PTI2, tbl_ddpr_mrs_actuals.PkgCd, tbl_ddpr_mrs_actuals.PkgDesc, tbl_ddpr_mrs_actuals.ProdLine, tbl_ddpr_mrs_actuals.TestPlatform, tbl_ddpr_mrs_actuals.CycleMonth, tbl_ddpr_mrs_actuals.PlanMonth, tbl_ddpr_mrs_actuals.DataType, tbl_ddpr_mrs_actuals.Outs FROM tbl_ddpr_mrs_actuals WHERE (Nz([Assy]) Like(" & Criteria1 & ")) " & _
"AND (Nz([PTI2]) Like(" & Criteria2 & ")) AND (Nz([PkgCd]) Like(" & Criteria3 & ")) AND (Nz([ProdLine]) Like(" & Criteria4 & ")) AND (Nz([CycleMonth]) Like(" & Criteria5 & "));"
ElseIf (ctl5.Selected(0) = True And ctl3.Selected(0) = True) Then
Q.SQL = "SELECT tbl_ddpr_mrs_actuals.Assy, tbl_ddpr_mrs_actuals.Test, tbl_ddpr_mrs_actuals.PTI2, tbl_ddpr_mrs_actuals.PkgCd, tbl_ddpr_mrs_actuals.PkgDesc, tbl_ddpr_mrs_actuals.ProdLine, tbl_ddpr_mrs_actuals.TestPlatform, tbl_ddpr_mrs_actuals.CycleMonth, tbl_ddpr_mrs_actuals.PlanMonth, tbl_ddpr_mrs_actuals.DataType, tbl_ddpr_mrs_actuals.Outs FROM tbl_ddpr_mrs_actuals WHERE (Nz([Assy]) Like(" & Criteria1 & ")) " & _
"AND (Nz([PTI2]) Like(" & Criteria2 & ")) AND (Nz([PkgCd]) Like(" & Criteria3 & ")) AND (Nz([ProdLine]) Like(" & Criteria4 & ")) AND (Nz([CycleMonth]) Like(" & Criteria5 & "));"
ElseIf (ctl5.Selected(0) = True And ctl2.Selected(0) = True) Then
Q.SQL = "SELECT tbl_ddpr_mrs_actuals.Assy, tbl_ddpr_mrs_actuals.Test, tbl_ddpr_mrs_actuals.PTI2, tbl_ddpr_mrs_actuals.PkgCd, tbl_ddpr_mrs_actuals.PkgDesc, tbl_ddpr_mrs_actuals.ProdLine, tbl_ddpr_mrs_actuals.TestPlatform, tbl_ddpr_mrs_actuals.CycleMonth, tbl_ddpr_mrs_actuals.PlanMonth, tbl_ddpr_mrs_actuals.DataType, tbl_ddpr_mrs_actuals.Outs FROM tbl_ddpr_mrs_actuals WHERE (Nz([Assy]) Like(" & Criteria1 & ")) " & _
"AND (Nz([PTI2]) Like(" & Criteria2 & ")) AND (Nz([PkgCd]) Like(" & Criteria3 & ")) AND (Nz([ProdLine]) Like(" & Criteria4 & ")) AND (Nz([CycleMonth]) Like(" & Criteria5 & "));"
ElseIf (ctl5.Selected(0) = True And ctl1.Selected(0) = True) Then
Q.SQL = "SELECT tbl_ddpr_mrs_actuals.Assy, tbl_ddpr_mrs_actuals.Test, tbl_ddpr_mrs_actuals.PTI2, tbl_ddpr_mrs_actuals.PkgCd, tbl_ddpr_mrs_actuals.PkgDesc, tbl_ddpr_mrs_actuals.ProdLine, tbl_ddpr_mrs_actuals.TestPlatform, tbl_ddpr_mrs_actuals.CycleMonth, tbl_ddpr_mrs_actuals.PlanMonth, tbl_ddpr_mrs_actuals.DataType, tbl_ddpr_mrs_actuals.Outs FROM tbl_ddpr_mrs_actuals WHERE (Nz([Assy]) Like(" & Criteria1 & ")) " & _
"AND (Nz([PTI2]) Like(" & Criteria2 & ")) AND (Nz([PkgCd]) Like(" & Criteria3 & ")) AND (Nz([ProdLine]) Like(" & Criteria4 & ")) AND (Nz([CycleMonth]) Like(" & Criteria5 & "));"
ElseIf ctl5.Selected(0) = True Then
Q.SQL = "SELECT tbl_ddpr_mrs_actuals.Assy, tbl_ddpr_mrs_actuals.Test, tbl_ddpr_mrs_actuals.PTI2, tbl_ddpr_mrs_actuals.PkgCd, tbl_ddpr_mrs_actuals.PkgDesc, tbl_ddpr_mrs_actuals.ProdLine, tbl_ddpr_mrs_actuals.TestPlatform, tbl_ddpr_mrs_actuals.CycleMonth, tbl_ddpr_mrs_actuals.PlanMonth, tbl_ddpr_mrs_actuals.DataType, tbl_ddpr_mrs_actuals.Outs FROM tbl_ddpr_mrs_actuals WHERE (Nz([Assy]) Like(" & Criteria1 & ")) " & _
"AND (Nz([PTI2]) Like(" & Criteria2 & ")) AND (Nz([PkgCd]) Like(" & Criteria3 & ")) AND (Nz([ProdLine]) Like(" & Criteria4 & ")) AND (Nz([CycleMonth]) Like(" & Criteria5 & "));"
Else
Q.SQL = "SELECT tbl_ddpr_mrs_actuals.Assy, tbl_ddpr_mrs_actuals.Test, tbl_ddpr_mrs_actuals.PTI2, tbl_ddpr_mrs_actuals.PkgCd, tbl_ddpr_mrs_actuals.PkgDesc, tbl_ddpr_mrs_actuals.ProdLine, tbl_ddpr_mrs_actuals.TestPlatform, tbl_ddpr_mrs_actuals.CycleMonth, tbl_ddpr_mrs_actuals.PlanMonth, tbl_ddpr_mrs_actuals.DataType, tbl_ddpr_mrs_actuals.Outs FROM tbl_ddpr_mrs_actuals WHERE ([Assy] In(" & Criteria1 & ")) " & _
"AND ([PTI2] In(" & Criteria2 & ")) AND ([PkgCd] In(" & Criteria3 & ")) AND ([ProdLine] In(" & Criteria4 & ")) AND ([CycleMonth] In(" & Criteria5 & "));"
End If

Q.Close
DoCmd.OpenQuery "qry_ddprmrsactuals"
DoCmd.Requery
DoCmd.OpenForm FormName:="frm_all"

End Sub
 
Jeeze...I got a headache just scrolling through your posted code. That's probably more code than I've written in Access in 8 years.. :)

Let's try to break this down a bit and see if we can't chop about 99% of that stuff out.

First, you have FIVE multi select list boxes. Your user can select NONE, ONE or more choices from EACH list box.

You want to make the SELECTIONS from the list boxes CRITERIA for a query, right?

What I would probably do here is approach this from a different point of view, since there are so many possible variations.

I would probably stick the CHOICES from the list boxes in temporary tables, and JOIN this or these temporary tables to the operational dataset in a query. That way, there's NO CODE to write, other than the query itself.

Clear the tables before each operation, and repopulate them from the list boxes.

I'm a firm believer in letting a DBMS do what it does best - work with tables of data. If you're new to Access, I'd strongly recommend that you don't even BOTHER with VBA coding until you can design a database correctly with your eyes closed and one hand tied behind your back. And when you can, you'll see that you don't need code nearly as often as you think.

Otherwise, you'll be trying to solve every problem with CODE, which is the wrong approach.

Jim

PS:
Also, I noticed that you don't explicitly define your "Q" variable:

Sub RunTest_Click()
Dim AssyDB
Dim Q


but then later on you assign a querydef to it???

Dim Q as QueryDef would probably be safer.

Also, there's no real reason to DIM your database:

Set AssyDB = CurrentDb()
Set Q = AssyDB.QueryDefs("qry_ddprmrsactuals")

Can be reduced to
Set q = CurrentDB.QueryDefs("qry_ddprmrsactuals")

Just a thought... How many of you believe in telekinesis? Raise my hand...
Another free Access forum:
More Access stuff at
 
To WildHare:

Thx for the suggestion. Could you pl take the time to explain how I stick the choices from the listbox into a table.

Thx for your advice. Its a great approach.

 
5PM Tue EDT - I will try to work up a solution and get something to you. My website is in the process of being moved from Linux to NT and I can't get anything posted there at the moment. If you care to, send me your email addy and I will respond. My email is on the website. (It's viewable, just not editable by me, at the moment)

Jim How many of you believe in telekinesis? Raise my hand...
Another free Access forum:
More Access stuff at
 
Jim

Thx for your response. I am looking at your sample file.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top