Select and write keys from two records

wcboyd

Registered User.
Local time
Yesterday, 18:51
Joined
Aug 30, 2004
Messages
50
Hello All,

If I want to select a row from subform A and a row from subform b and click a button and have the keys stored in another table what would be the best way to do that?

Thanks.
 
Does it help you when I say that clicking on a record in a SubForm makes that record the Current Record for that form?
 
I think it helps.
In SubformA in the OnCurrent Event I placed an expression setting the value of a field in SubformC, but I get the following error:
Code:
The expression On Current you entered as the event property setting produced the following error: Microsoft Office Access can't find the form 'SubformC' referred to in a macro expression or Visual Basic code.

Any thoughts?

Thanks.
 
How about posting the code you are using so we can see it?
 
That would have been the smart thing to do in the first place. Sorry.:o

Code:
=Forms!TableObjeMapping![ObjectTableAttributeMapping subform].Form!ParentTableAttrId=[TableAttId]

I had removed this line from the "On Current" event to try something else, but now when I put it back it is giving me a different error when the form is loading:
Code:
The expression On Current you entered as the event property setting produced the following error: Type mismatch

I checked the two fields in the tables and the source [TableAttId] is an AutoNumber (Long Integer) and the target field [ParentTableAttrId] is a Number (Long Integer) so they should be compatible. I am not sure where the type mismatch could be coming from.

Thanks RG.
 
Hi Craig,
How about the rest of the code around the line you posted. 2 "=" signs???
Code:
=Forms!TableObjeMapping![ObjectTableAttributeMapping subform].Form!ParentTableAttrId=[TableAttId]
Are you trying to set a control in a SubForm to a value of a control in the Main form?
 
RG,

I am actually trying to set the value in one subform with the value from another subform.

That is all the code. Expression Builder put the leading = in the On Current event.

Thanks.
 
RG,
Now it is telling me "Microsoft Office Access can't find the macro 'Forms!TableObjeMapping!ObjectTableAttributeMapping subform1.'

Thanks.
 
The syntax is FORMS!MainFormName!SubFormControlName.FORM!ControlNameOnSubForm
The SubFormControlName may not be the same name as the SubForm. Often it is because it is the default name but it is not a requirement.
 
RG,

Here is my statement:
Code:
Forms!TableObjeMapping![ObjectTableAttributeMapping subform].Form!ParentTableAttrId=[TableAttId]

You said:
The syntax is FORMS!MainFormName!SubFormControlName.FORM!Control NameOnSubForm

So the mapping would be:
FORMS!MainFormName = TableObjeMapping
SubFormControlName = ParentTableAttrId

So my statement should look like:
Code:
FORMS!TableObjeMapping!ParentTableAttrId=TableAttId

Right?
BTW, thank you VERY much for patiently working me through this.
 
Not exactly. Forms are displayed on other forms by the use of a SubFormControl. This control has its own name that defaults to the name of the form it is displaying but can be changed. That is the SubFormControlName I was referencing. Your code indicates that the SubFormControl is named [ObjectTableAttributeMapping subform]. Is that true? [Brackets] are required because of the embedded space in the name.
 
Your code indicates that the SubFormControl is named [ObjectTableAttributeMapping subform].
The actual SubFormControl name = [ObjectTableAttributeMapping subform1]
So the On Current should be:
Code:
FORMS!TableObjeMapping![ObjectTableAttributeMapping subform1].FORM!ParentTableAttrId=TableAttId

Right?
 
That looks correct. You know you are on the SubFormControl when the data tab has the LinkMasterField and LinkChildField properties and the other tab has the name of the control.
 

Users who are viewing this thread

Back
Top Bottom