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

Multi Select Listbox 1

Status
Not open for further replies.

jeffshex

Technical User
Jun 30, 2005
208
US
Duane,

I've been trying to get that listbox code you showed me to work. Maybe you might know where I'm goofing.
I pasted the code in a module and named it modMulitSelect, starting with the BuildIn line and ending with the End Function. My form has 2 listboxes and a start date and end date box as well. I named the listboxes lboTTeam and lboTLocation.
I put this as the commond Ok click:
Code:
Private Sub cmdOK_Click()

Dim strWhere As String
strWhere = " 1=1 "
strWhere = strWhere & BuildIn(Me.lboTTeam)
strWhere = strWhere & BuildIn(Me.lboTLocation)
DoCmd.OpenReport "rptStatusReports", acViewPreview, , strWhere
Me.Visible = False
End Sub
*I threw the me.visible in there to close the open form*

When I click ok on the form, it closes and brings up another dialog box asking for a parameter for Team. I looked and made sure there were no queries with that prompt. If I click ok on that box, it brings every team in the date range regardless of what team you selected or location.
Any clue as to what is going on?

Thanks - Jeff
 
I think I got it.
Here's the code I used:
Code:
Private Sub lboTProjects_AfterUpdate()

Dim strWhere As String
strWhere = " 1=1 "
strWhere = strWhere & BuildIn(Me.lboTProjects)

Me![txtProjects] = strWhere
End Sub
Is there any easy way so the user only sees the project numbers in there and not the "1=1 And Projects In ..." line?
-------
I'm assuming that the updated query definitions will be placed under the Ok click event and point it to look towards the textbox correct?

Thanks,
Jeff
 
Jeff,
I think you should figure out how to exclude the 1=1. Search Help on Left, Mid, Right, Instr, ...

You would need some event to perform the update of the SQL property of the saved query. This could be the on click event of a command button.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top