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

list box error

Status
Not open for further replies.

skd2726

MIS
Jul 2, 2002
24
0
0
US
I have a report that is based on a list box in a form - the user is to pick items from the list box and then a report runs filtered on the list box ...I have tried it 2 ways ...both ways I get an the following error

"EXTRA ) in quiery expression '(Name =)'

HELP!!!


First Way:

Private Sub cmdReport_Click()
On Error GoTo Err_cmdReport_Click


DoCmd.OpenReport "CrewAssigmentReport", acViewPreview, , "Name = " & List0


Exit_cmdReport_click:
Exit Sub

Err_cmdReport_Click:
MsgBox Err.Description
Resume Exit_cmdReport_click

End Sub

2nd Way:
Private Sub Command3_Click()
On Error GoTo Err_Command3_Click

Dim stDocName As String

stDocName = "CrewAssigmentReport"
DoCmd.OpenReport stDocName, acPreview, , "[Name] = " & Forms!frm_GetReports!List0

Exit_Command3_Click:
Exit Sub

Err_Command3_Click:
MsgBox Err.Description
Resume Exit_Command3_Click

End Sub
 

How many columns do you have in your list box?
How about this?
Code:
DoCmd.OpenReport "CrewAssigmentReport", acViewPreview, , "Name = " & List0.column(1)
Remember, the first column in column 0.


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top