Best phone camera 2016/2017: Galaxy S7 vs iPhone 7 vs Google Pixel vs HTC 10 Evo vs OnePlus 3T vs…
I've built a database with several reports created from queries.
The queries are simple Select queries eg listing all repairs carried out by an engineer between 01/04/03 & 30/04/03.
So when you select a query 3 boxes pop up one after another asking for the engineers name then start & finish dates.
Obviously the query only works if you spell the name correctly, so my life would be easier if I could have a combo box in the query pop-up that takes names from the staff table, but for the life of me I can't figure out how to put a combo box in the query pop-up.
Anyone got any ideas, short of me going & buying one of those huge Microsoft Press books that cost almost as much as the software?
I've tried it, and if you open the page via the link, and then just copy and paste the remainder of the link in addition, you should arrive at the article.
Give this a try alan14:
Open the query in Design view. In the query design grid, right-click anywhere in the column of the field you want to change, and then click "Properties" on the shortcut menu. Click the "Lookup tab". In the DisplayControl property box, click Combo Box.
I think that may just do the trick, the database is at work, so I'll have to wait until Tuesday to check it, so I'll wait until then before I tick resolved.
BTW I had to join the website to view the content, I'm not going to get even more spam in my hotmail box am I?
It's a site for professionals.
Hope it helps you.
Guess that doesn't cover me then, I was printing some greetings cards this afternoon & forgot to take the leftover cards out of the printer, so the article has printed on 170gm shiny card!
Sorry, your response didn't help me in the way I wanted.
From what I can work out I need to set up a form & run the query from the form, but I can't figure out how to do this.
Unfortunately I don't have unrestricted web access at work, so I can't search around for an answer, I've had a dig around the help file & on Microsoft's website to no avail.
I'll have to go to the library on Saturday & borrow one of those huge Microsoft Office books.
Thanks for the help anyway, that site looks useful for future needs.
To my knowledge alan14, you cannot "set up a form & run the query from the form".
You can run a query from a Table, then from the query run a Form or Report. Once the query has been created you can create a Form, then you can set any field within that Form to become a Combo box or a list box.
A short answer to your question - yes it is possible to run a query from a form. The basic idea is that you would create a form with a combo box and 2 text boxes, the combo box would read data from the table containing engineers while the text boxes would be used to input the dates. It is then possible to reference these form controls from the query & to open the query by clicking on a button on the form.
To save explaining all the details of this solution I have prepared a quick example for you - click here should have a link on the page to download an access 2000 mdb file. All of the controls on the form were created using the wizard as this is the quickest way to create simple controls such as these so error handling is included if you look at the code.
If there are any more questions then let me know.
I just re-read your original post - if you have a report that is based on the query then you can change the 2 lines of code behind the command button to:
stDocName = "MyReportName"
docmd.OpenReport stdocname, acViewPreview
You will see which lines I mean - they look very similar in the example I provided.
This thread is now locked and can not be replied to.