Zydeceltico
Registered User.
- Local time
- Today, 18:29
- Joined
- Dec 5, 2017
- Messages
- 843
Hi All -
I have a main form bound to a main table. Eight buttons on frmMainForm open eight different popup forms. Each of those popup forms are bound to a unique table. Each of them represents a unique type of inspection.
In frmMainTable I have field called InspectionType_FK that has a datatype of Integer.
I also have a lookup table called tblInspectionType with 2 fields: the autnumber PK (InspectionType_ID) and InspectionType as a string (e.g., Mill, Assemble, Weld, etc...)
So I know I could put a combobox on frmMainForm and have the user select which type of inspection they are going to do, immediately grab that value to be stored in my field InspectionType_FK and then click a button to open the inspection.
However - - 1) I think that is prone to create errors and 2) I think it would be much more elegant to NOT have a combo box at all, the user clicks one of the eight buttons to open an inspection form, and in the background a uniqque numeri value corresponding to InspectionType_FK is captured to be placed in tblMainForm's InspectionType_FK field.
I think I am working this out as I type right now but I am sure I have wholes in my logic.
So I think I need to create a variable in frmMainForm called intInspTyp As Integer. The idea being that when one of the buttons is clicked code runs that places a value in intInspType and then later when frmMainForm is saved the InspectionType_FK value is recorded. I'll have an invisible txtBox to hold the value actually instead of a declared variable.
What I don't know how to do is enumerate the behind-the-scenes values for each of the buttons corresponding to the lookup table of inspection types.
The reason I want to do this is to be able - at a later date - to easily review sets and subsets of ALL inspections of given type.
Thoughts? I'm guessing that a solution might involve Select Case and some If/Else If statements (which I have never attempted) OR one of ya'll as is typical can inform me that I making this too complicated for myself!
Thanks,
Tim
I have a main form bound to a main table. Eight buttons on frmMainForm open eight different popup forms. Each of those popup forms are bound to a unique table. Each of them represents a unique type of inspection.
In frmMainTable I have field called InspectionType_FK that has a datatype of Integer.
I also have a lookup table called tblInspectionType with 2 fields: the autnumber PK (InspectionType_ID) and InspectionType as a string (e.g., Mill, Assemble, Weld, etc...)
So I know I could put a combobox on frmMainForm and have the user select which type of inspection they are going to do, immediately grab that value to be stored in my field InspectionType_FK and then click a button to open the inspection.
However - - 1) I think that is prone to create errors and 2) I think it would be much more elegant to NOT have a combo box at all, the user clicks one of the eight buttons to open an inspection form, and in the background a uniqque numeri value corresponding to InspectionType_FK is captured to be placed in tblMainForm's InspectionType_FK field.
I think I am working this out as I type right now but I am sure I have wholes in my logic.
So I think I need to create a variable in frmMainForm called intInspTyp As Integer. The idea being that when one of the buttons is clicked code runs that places a value in intInspType and then later when frmMainForm is saved the InspectionType_FK value is recorded. I'll have an invisible txtBox to hold the value actually instead of a declared variable.
What I don't know how to do is enumerate the behind-the-scenes values for each of the buttons corresponding to the lookup table of inspection types.
The reason I want to do this is to be able - at a later date - to easily review sets and subsets of ALL inspections of given type.
Thoughts? I'm guessing that a solution might involve Select Case and some If/Else If statements (which I have never attempted) OR one of ya'll as is typical can inform me that I making this too complicated for myself!

Thanks,
Tim
Last edited: