SETVALUE in in Macro for subform control fails

P

Phil

OK. I have a form based on nothing. It contains a couple of buttons to
open up queries, and a subform which opens in datasheet view.

On this subform, I have a couple of combo boxes. I want to to use
dlookup to populate a couple of other fields in the subform (linked to
an underlying table) based on the combo box.

I set up in the AFTERUPDATE property of the combobox to a macro. That
Macro has three SetValue commands, with the dlookup statement. If the
form is open all by itself, it works, but as a subform of the mainform,
I get an error complaining it can not find the form.

[Forms]![Phone_Complaints]![Rep_#]

Is what I am using, and Phone_Complaints is the name of the form.

How do I refer to that field when Phone_Complaints is actually a subform
of MainForm?

Thanx
 
J

John Vinson

[Forms]![Phone_Complaints]![Rep_#]

Is what I am using, and Phone_Complaints is the name of the form.

How do I refer to that field when Phone_Complaints is actually a subform
of MainForm?

[Forms]![Mainform]![NameOfSubformControl].Form![Rep_#]


The name of the subform control is not necessarily the same as the
name of the form within that control (though it often will be).

John W. Vinson[MVP]
 
Top