P
Pendragon
Access03/WinXP
A form allows a sales rep to select a Trade Name and assign it to a specific
company. When a Trade Name needs to be added to the underlying source table,
an admin person has gone into the database window and opened the table to
enter in new information; the table is accessed by a label on the form using
a hyperlink. I'm trying to prevent this. This style of adding data is
prevalent in my client's application.
I've created a form, frmResults, which has various command buttons in the
form's header for the admin's needs. The detail section of frmResults is a
subform, frmResultsSub. frmResultsSub is set with an unbound Source Object.
Depending on where in the database a user is coming from, I would like to be
able to set the Source Object programmatically; all Source Objects are simple
queries on the relevant table. In the above example, the Source Object would
be qryTradeNames.
I initially thought above a public variable (strSource) but I don't know
enough about defining them and using them. Now from my reading on threads in
these Access newsgroups, I'm thinking this is not a good idea....???
The application always opens to a Main Switchboard, so if I understand
correctly, I would have "Public strSource as String" immediately under the
Options statement and before any Private Subs. strSource should be
initialized to "". How is this done?
Then, in frmTradeNames, when the user clicks on the label "Edit Trade
Names", in the OnClick property I would define strSource to be
"qryTradeNames".
In the OnOpen property of frmResults, the SourceObject property of the
subform frmResultsSub is set to strSource (whose value is qryTradeNames).
In the OnClose property of frmResults, strSource is reset to "".
Does this flow make sense? Is it appropriate? If so, I would appreciate
specifics on coding and placement of the code.
If not, suggestions are most welcome.
Thanks!
A form allows a sales rep to select a Trade Name and assign it to a specific
company. When a Trade Name needs to be added to the underlying source table,
an admin person has gone into the database window and opened the table to
enter in new information; the table is accessed by a label on the form using
a hyperlink. I'm trying to prevent this. This style of adding data is
prevalent in my client's application.
I've created a form, frmResults, which has various command buttons in the
form's header for the admin's needs. The detail section of frmResults is a
subform, frmResultsSub. frmResultsSub is set with an unbound Source Object.
Depending on where in the database a user is coming from, I would like to be
able to set the Source Object programmatically; all Source Objects are simple
queries on the relevant table. In the above example, the Source Object would
be qryTradeNames.
I initially thought above a public variable (strSource) but I don't know
enough about defining them and using them. Now from my reading on threads in
these Access newsgroups, I'm thinking this is not a good idea....???
The application always opens to a Main Switchboard, so if I understand
correctly, I would have "Public strSource as String" immediately under the
Options statement and before any Private Subs. strSource should be
initialized to "". How is this done?
Then, in frmTradeNames, when the user clicks on the label "Edit Trade
Names", in the OnClick property I would define strSource to be
"qryTradeNames".
In the OnOpen property of frmResults, the SourceObject property of the
subform frmResultsSub is set to strSource (whose value is qryTradeNames).
In the OnClose property of frmResults, strSource is reset to "".
Does this flow make sense? Is it appropriate? If so, I would appreciate
specifics on coding and placement of the code.
If not, suggestions are most welcome.
Thanks!