H
Hatchet
I have two different forms (I'll call form A and form B) that share the same
subform (I'll call form C) which in turn contains a query. Form C does not
have a direct relationship with either Form A or B - there are no child
fields or master fields linked between the forms. On this query (in form C),
I have an "On Click" macro set for the ID field. This macro essentially
searches for the record on form A or B that I just clicked on in form C,
thereby bringing up the information associated with that particular record.
Form A and Form B are never open at the same time (two different audiences
each uses one of them), so I have the macro set with conditions to determine
which one to search for the record.
My problem is that the SearchForRecord macro works perfectly for Form A, but
starts pulling the wrong record up on Form B after the third time using the
macro. Does anyone have any ideas?
Here is the code for the macro I have. I've listed it out the condition,
action, and arguments as they appear on the macro per row.
Row 1:
Condition:
Action: SetTempVar
Arguments: ClickedID, [ID]
Row 2:
Condition: [screen].[activeform].[Name] = "Form A"
Action: SearchForRecord
Arguments: Form, Form A, First, ="[ID] =" & [TempVars]![ClickedID]
Row 3:
Condition: [screen].[activeform].[Name] = "Form B"
Action: SearchForRecord
Arguments: Form, Form B, First, ="[ID] =" & [TempVars]![ClickedID]
Row 4:
Condition:
Action: RemoveTempVar
Arguments: ClickedID
Thanks in advanced for your help.
subform (I'll call form C) which in turn contains a query. Form C does not
have a direct relationship with either Form A or B - there are no child
fields or master fields linked between the forms. On this query (in form C),
I have an "On Click" macro set for the ID field. This macro essentially
searches for the record on form A or B that I just clicked on in form C,
thereby bringing up the information associated with that particular record.
Form A and Form B are never open at the same time (two different audiences
each uses one of them), so I have the macro set with conditions to determine
which one to search for the record.
My problem is that the SearchForRecord macro works perfectly for Form A, but
starts pulling the wrong record up on Form B after the third time using the
macro. Does anyone have any ideas?
Here is the code for the macro I have. I've listed it out the condition,
action, and arguments as they appear on the macro per row.
Row 1:
Condition:
Action: SetTempVar
Arguments: ClickedID, [ID]
Row 2:
Condition: [screen].[activeform].[Name] = "Form A"
Action: SearchForRecord
Arguments: Form, Form A, First, ="[ID] =" & [TempVars]![ClickedID]
Row 3:
Condition: [screen].[activeform].[Name] = "Form B"
Action: SearchForRecord
Arguments: Form, Form B, First, ="[ID] =" & [TempVars]![ClickedID]
Row 4:
Condition:
Action: RemoveTempVar
Arguments: ClickedID
Thanks in advanced for your help.