Noob needs help

Benjamin.Winchester

New member
Local time
Today, 02:11
Joined
Feb 4, 2012
Messages
1
Please understand, my understanding of access is very limited, as my current project is my means to teach myself VB.

Problem: I have a form (Ill call it FormA) with two subforms (both in continuous form view, Ill call these SubformA and SubformB). SubformA references a Query, and SubformB references a table different than the Query's Table.

FormA
SubformA - References QueryA of TableA
SubformB - References TableB
"Update" Button

If I have a record from SubformA selected and click "Update", I want to open FormB to that record. If I have a record from SubformB selected and click "Update", I want to open FormC to that record.

Ive tried a few different approaches in the OnClick event for the Update button. To name a few, Ive tried an If...Then statement trying to reference the control that is active, Ive tried using bookmark property, and a few other things Ive forgotten now that I been trying so long. I know this is coming form my lack of understanding of the language.

Please help!
 
Are the data in SubformA and SubformB connected in any way? Are these data connected to the main form? Assuming “no” to both these questions, then you have no intrinsic link between the records. You may be able to use the Form_Current event of each subform to determine which one is selected (i.e. user has just clicked on something in the subform) and use DoCmd.OpenForm to open the next required form. If you need this to happen only when the Update button is pressed, put a Public variable in the parent form and use the subform Form_Current event to set something in this which is meaningful (e.g. SubformA might do Me.Parent!variablename = “A”, so when Update is pressed, its code checks variablename and reacts accordingly. I would suggest clearing the variable each time Update is pressed so you don’t get repetitive actions in error (multiple consecutive presses of update).
 

Users who are viewing this thread

Back
Top Bottom