Multiple names per Car Registration Number

User avatar
silverback
5StarLounger
Posts: 774
Joined: 29 Jan 2010, 13:30

Multiple names per Car Registration Number

Post by silverback »

My user has a requirement to look up a car registration and find the registered owner.
At the moment, I have a very simple, unbound, form which has a combo box listing all the recorded car registrations and when a car reg. is input/selected, a VB BeforeUpdate event enters code which performs a DLookup to find the registered owner and then pastes that name into a text box control on the form.

It has now been pointed out that, because there are numerous couples at this place of work, the same registration can be recorded for two (possibly more than 2?) staff members.

What is the simplest possible design for the form which can display one or more names when a car registration is input? is the only way to go to sub-forms and record selection code?

Thanks
Silverback

User avatar
Wendell
4StarLounger
Posts: 482
Joined: 24 Jan 2010, 15:02
Location: Colorado, USA

Re: Multiple names per Car Registration Number

Post by Wendell »

The subform would be my approach - I think it's actually simpler than the DLookup process you are currently using. All you would need to do is to modify the subform RecordSource - although it wouldn't necessarily have to be a subform. You could actually put the combo box in the header, and then set the data source for the form in code based on the record chosen in the combo box. Modifying the record source of the current form is a bit easier - you can use a filter, or you can actually change the SQL string that servers as the record source.
Wendell
You can't see the view if you don't climb the mountain!

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

Re: Multiple names per Car Registration Number

Post by HansV »

You could also use a list box, and set its Row Source dynamically.
Best wishes,
Hans

User avatar
silverback
5StarLounger
Posts: 774
Joined: 29 Jan 2010, 13:30

Re: Multiple names per Car Registration Number

Post by silverback »

Wendell and Hans
So simple when I'm pointed in the right direction!
I have gone for the List Box option and it's all working, now.

Thanks again, both, for your help
Silverback