Simple Access question

User avatar
ErikJan
BronzeLounger
Posts: 1228
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Simple Access question

Post by ErikJan »

My knowledge of Access is minimal but I'm helping someone who is using an old Access version with a simple flat database and could need some small help.
The person has a big table with the data and a form to allow quick data entry and review (the table also contains e.g. street, house-number, and data fields). We'd like to add a simple interface where a person can enter or select a street, a number and a date and then get the unique record ID back so (s)he can now find the full record in the main table. Of course this search form should not allow changes to the underlying table [so read-only here]. I'm thinking the form should therefore be based on a query but I'm guessing here already.
Related, I also wonder how to discriminate between a GUI (read: a form) that allows editing / input of records and one that only allows viewing (read-only).
I apologize for the simple questions, hope someone can guide me in the right direction a bit...

User avatar
HansV
Administrator
Posts: 78415
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Simple Access question

Post by HansV »

Create an unbound form, i.e. leave its Record Source empty.
Place text boxes for the street, house number and date on the form, plus a command button.
The On Click event procedure of the command button would open the form bound to the table, filtered for the record that matches the values entered in the text boxes.

And alternative would be to place the text boxes and command button in the header or footer of the data entry form.
Best wishes,
Hans

User avatar
ErikJan
BronzeLounger
Posts: 1228
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Simple Access question

Post by ErikJan »

OK, but then the fields should have to be typed-in (which might be OK) but there would not be e.g. dropdown with the possible choices (matching the main table)?

User avatar
HansV
Administrator
Posts: 78415
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Simple Access question

Post by HansV »

You could use combo boxes with a Row Source of for example

SELECT DISTINCT street FROM mytable

If you want the combo boxes to be related, for example if the house number combo box should only list numbers for the street that has been selected, you'd need a bit of VBA to tie it all together. (This is called 'cascading combo boxes')
Best wishes,
Hans

User avatar
ErikJan
BronzeLounger
Posts: 1228
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Simple Access question

Post by ErikJan »

OK, thanks. Probably will try to build a small mock-up myself but not sure if I'll manage. It's a start :)

User avatar
HansV
Administrator
Posts: 78415
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Simple Access question

Post by HansV »

Feel free to come back with more questions.
Best wishes,
Hans