SETVALUE in in Macro for subform control fails

  • Thread starter Thread starter Phil
  • Start date Start date
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
 
[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]
 
OK, well that worked perfectly, thank you very much.







John said:
[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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top