Full Version: create a menu from a query
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
stevendambra
I hope i'm going about this correctly...
(part 1) After a user runs a query,
(part 2)the results will return by the field "Last Name" in some sort of a menu.
(part 3) If they click on "Last Name", the form will pop up on screen and show all information.

Any resources that could direct me upon going about this?
link and such?
I'm trying to find info on part 2 and 3.
bekibutton
Welcome to UA frown.gif

I personally do this with a listbox. Mine is based on an SQL query but I guess it works with a 'parameter' query too (as the rowsource). I have it bring up the results in the listbox and then set the OnClick or DoubleClick event to open the form, filtered by the item clicked in the listbox. I hope that makes sense! I'll have a look around for some articles etc. if you want frown.gif

Hope this helps,

Becki
stevendambra
thank you very much.
You solved my problem.
Much thanks

btw, i'm a lurker on her. Hardly ever post, but sure do read alot.
stevendambra
any tips on how to open a form through a listbox?
bekibutton
I use the OnClick or OnDoubleClick event of the listbox and do something like:
CODE
Private Sub lboMenu_Click()
On Error GoTo Err_lboMenu_Click

Dim stLinkCriteria As String
Dim stDocName As String

stLinkCriteria = "[id]=" & Me.lboMenu.Column(2) & ""
stDocName = "frmComplete"

DoCmd.OpenForm stDocName, , , stLinkCriteria    
DoCmd.Close acForm, "frmMenu"

Exit_frmMenu_Click:
    Exit Sub

Err_frmMenu_Click:
    MsgBox Err.Description
    Resume Exit_frmMenu_Click
    
End Sub

This basically opens the form where "id" equals the [id] value in column 2 of my listbox. You can set it to open using the data from any column.

If your data is text then you need single quotes around your listbox value, ie:

"[UserName]='" & Me.lboMenu.Column(2) & "'"

Or if it's a date then the quotemarks should be '#'.

Hope that helps!
Becki
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.