Programatically Select From 9 forms from primary screen

G

Guest

My DB is coming along very well, I think, thanks to you kind folks. I was
warned that this stage of the process would be complex due to the nature of
the database.

A little background:
db is all elements of vessel maintenance including shore personnel,
vessel/personnel certifications/documentations/inspections, jobtypes(6
varieties), per vessel and facility equipment tracking (serial #s-unique ids)
and model info such as horsepower-ratio-bore stroke etc

It was this final element which sent me into the subclassing need and from
where my forms issue stems.

I tabled the relevant information as follows:

tblFleet(FleetID-pk)
tblCategory(CategoryID-pk)-ex. mechanical,electrical,firesuppression etc.
tblSystems(SystemID-pk,CategoryID-fk)-ex. MainEngine(mechanical-cat:fk)
tblManufacturers(ManufacturerID-pk)-ex.Caterpillar,TwinDisc etc.)
tblSysManModel(SysMMID-pk,SystemID-fk,ManfacturerID-fk)-ex. 3508
tblVesselEquipment-(VslEqID-pk,FleetID-FK,SysMMID-fk+specifics to that peice
of equipment)-ex. serialnumbers, service meter, LastServiceDate

{Up to this stage I'm doing the Snoopy dance}

Here I need to be able to access the individual forms for the various models
by system. The attributes of equipment which needed to be tracked resulted
in 9 tables which have a 1:1 relationship with tblSysManModel

At frmSysManModel I'd like a command button with a caption something like
"Enter Model Specifications" at the point when the Manufacturer has been
added or identified and the System-Manufacturer-Model has been added or
identified. I'd like the program to identify the appropriate form to open.

Ex.
If SystemID=34,35 or 36 Open frmME where
frmME.SysmanmodelID=Forms!SysmanModelID or newrecord

If SystemID=38 OpenfrmMG where frmMG.SysmanmodelID=Forms!SysmanModelID or
DataEntry=true(that means new record,right?)

Any suggestions on the best way to proceed would be much appreciated.

Thanks
Mary
 
G

Graham R Seach

The Case statement works very well in such situations:

Select Case SystemID
Case 34, 35, 36
DoCmd.OpenForm "frmME", , , "SysmanmodeID = " & Me!SysmanModelID
Case 38
DoCmd.OpenForm "frmMG", , , "SysmanmodelID = " & Me!SysmanModelID
Case Else
'Do something else
End Select

....and yes, DataEntry=True does mean new record.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Top