By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,679 Members | 2,763 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,679 IT Pros & Developers. It's quick & easy.

Have a different subforms load depending on cell in a record of theparent form

P: n/a
Rob
I am putting together a small Access 2003 DB to record details of our
motorvehicles. (this is more to teach myself some basics with Access)

The main form is holding data that is common to most vehicles. Eg.
Registration date, expiry, VIN/Chassis, Make, Model, Year.

Additional things that I will record is maintenance/servicing, insurance
etc etc.

The vehicles are a bit varied,: Cars, truck, trailer, motorbikes, caravan.

For these there are different servicing scheduels and I would like to
include them individually.

I have tabs for registration, servicing, insurance, Wheels&tyres etc.

Because of the differences in servicing, I have created 4 subforms for that.

Now I would like to find a way that will load the correct subform when I
load each record in the main form. I had thought that I could make a
col. called ServiceType with a dropdown with options 1, 2, 3 and 4 and
somehow have the correct subform reference this column then load.

Any thoughts on how to go about something like this.
With Thanks
Rob
Sep 30 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Rob" <dy@woodyallan.bizwrote in message
news:cB*****************@news-server.bigpond.net.au...
>I am putting together a small Access 2003 DB to record details of our
motorvehicles. (this is more to teach myself some basics with Access)

The main form is holding data that is common to most vehicles. Eg.
Registration date, expiry, VIN/Chassis, Make, Model, Year.

Additional things that I will record is maintenance/servicing, insurance
etc etc.

The vehicles are a bit varied,: Cars, truck, trailer, motorbikes, caravan.

For these there are different servicing scheduels and I would like to
include them individually.

I have tabs for registration, servicing, insurance, Wheels&tyres etc.

Because of the differences in servicing, I have created 4 subforms for
that.

Now I would like to find a way that will load the correct subform when I
load each record in the main form. I had thought that I could make a col.
called ServiceType with a dropdown with options 1, 2, 3 and 4 and somehow
have the correct subform reference this column then load.

Any thoughts on how to go about something like this.
I would have thought that some code in your form's Current event would do
this, something along the lines of:

If Me.txtVehicleType = "Car" Then
Me.MySubformObjectName.SourceObject = "sfrmCar"
ElseIf ...

.... and so on. You'd probably have to set the LinkMasterFields and
LinkChildFields properties too.

Regards,
Keith.
www.keithwilby.com

Sep 30 '08 #2

P: n/a
Keith Wilby wrote:
"Rob" <dy@woodyallan.bizwrote in message
news:cB*****************@news-server.bigpond.net.au...
>I am putting together a small Access 2003 DB to record details of our
motorvehicles. (this is more to teach myself some basics with Access)

The main form is holding data that is common to most vehicles. Eg.
Registration date, expiry, VIN/Chassis, Make, Model, Year.

Additional things that I will record is maintenance/servicing,
insurance etc etc.

The vehicles are a bit varied,: Cars, truck, trailer, motorbikes,
caravan.

For these there are different servicing scheduels and I would like to
include them individually.

I have tabs for registration, servicing, insurance, Wheels&tyres etc.

Because of the differences in servicing, I have created 4 subforms for
that.

Now I would like to find a way that will load the correct subform when
I load each record in the main form. I had thought that I could make
a col. called ServiceType with a dropdown with options 1, 2, 3 and 4
and somehow have the correct subform reference this column then load.

Any thoughts on how to go about something like this.

I would have thought that some code in your form's Current event would
do this, something along the lines of:

If Me.txtVehicleType = "Car" Then
Me.MySubformObjectName.SourceObject = "sfrmCar"
ElseIf ...

... and so on. You'd probably have to set the LinkMasterFields and
LinkChildFields properties too.

Regards,
Keith.
www.keithwilby.com
It might be easier for the op to have a command button called Servicing
Schedule and based on the type of vehicle open a separate form depending
on the type.
Sep 30 '08 #3

P: n/a
"Salad" <oi*@vinegar.comwrote in message
news:A7******************************@earthlink.co m...
Keith Wilby wrote:
>"Rob" <dy@woodyallan.bizwrote in message
news:cB*****************@news-server.bigpond.net.au...
>>>
Any thoughts on how to go about something like this.

I would have thought that some code in your form's Current event would do
this, something along the lines of:

If Me.txtVehicleType = "Car" Then
Me.MySubformObjectName.SourceObject = "sfrmCar"
ElseIf ...

... and so on. You'd probably have to set the LinkMasterFields and
LinkChildFields properties too.

Regards,
Keith.
www.keithwilby.com

It might be easier for the op to have a command button called Servicing
Schedule and based on the type of vehicle open a separate form depending
on the type.
I agree it's a bit fiddly to get it working but is quite slick when it is.

Sep 30 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.