Simple Query Lookup?

winpooh5

Registered User.
Local time
Today, 22:03
Joined
Nov 1, 2004
Messages
18
Hi. I'm new to database programming. So far, I've learnt up to creating a Parameter Query (I think) on my own. It'll prompt me to type in a value, but how can I get it to display a list of values from a table (so that I don't have to type it in)?

I've managed to create Lookups in my Tables, but I can't seem to get it (lookups) to work in my Queries. What should I type in the Criteria cell? Any help is much appreciated.
 
what you are best doing, is creating a simple form, have a lookup combo box on there, which looks in what ever field you need, then call that combo box "cmbLookup1", then call your form "frmLookup1".

erase the parameter quote you have put into your query and replace it with the following (just change the text according to your own names)

[forms]![frmlookup1]![cmblookup1]


I hope this helps, if it does not let me know, and i will be able to help you futther...
 
Hi. Thanks for your suggestion.

I had to fiddle around with the Forms for a little while (since I was not yet familiar with it), but I finally got it to work. I also added the Open Query macro (On Change) so that my query will open automatically upon selection :)

Thanks again for pointing me in the right direction - otherwise, I'd have been up against a dead end and wasted countless hours.
 
Lookup parameter query

Hi

Newbie alert ! Mind you, I am very close to completing a wonderful little database for my team at work and they will love me to bits when I show it to them.

Man - I've tried and tried to do the thing described below. Can't do it - been messing for a couple of days. Got the form, the combo box and the dropdown working - just can't get the query to reference the selection data from the form.

Would any of you experts mind knocking up a quick example of one of these queries with a parameter dropdown form. It would probably only take an expert a couple of minutes !! I've had success in the past by copying from other people's examples.

Sorry to be so thick

NoVoiceLeft
 
Here is the form with three drop down boxes

and with the query the drives the subform.

each combobox has a requery attached to the OnChange Event.

Me.mySubform.Requery


If you can get the hang of this, then you will be well on your way
to figuring out form use.

sportsguy
"pictures are worth thousands of words!"
 

Attachments

  • DropdownCombos.gif
    DropdownCombos.gif
    33.1 KB · Views: 129
Oh man - I can't get this working. Its frustrating as I've ploughed through stuff that felt like it was a lot more difficult than this.

As my input form, I have built a form called frmDeptlookup with one field called combDept and that works - I get to choose from a dropdown list of Departments from the Table called Departments. So far so good.

On the query side, my query works fine when I type the name of a Department into the Criteria. For example, when my criteria for Department is "Real Estate" I get exactly the result I want.

When I use [Enter Dept name] in the Criteria for Department and then type Real Estate in the standard pop-up box that appears - I get exactly the result I want.

But when I use

Like [Forms]![frmDeptlookup]![comboDept

(using the query builder) in the Criteria, I just get the standard pop up box with a prompt "Like [Forms]![frmDeptlookup]![comboDept]" - so its not made the reference.

I have not yet added the On Change event. I don't really understand that. I assume I have to write Me.Something.Requery - but what is the something ? the name of my Query or frmDeptlookup ?

NoVoiceLeft
 
Voila !

I've got theis sorted now - from another thread.

Thanks everyone - especially Trucktime

NoVoice
 

Users who are viewing this thread

Back
Top Bottom