Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run query on main form field, update data to subform

Status
Not open for further replies.

Glacil

MIS
Jul 7, 2004
9
US
Hi

I'm trying to cause a field on a subform to update when data is entered in a field on the main form, but because one is on a subform and the other is on the main form,

Willir supplied me with this code, which is working in all respects except that I cannot run it from the main form, only the subform:

If Nz(Combo8, 0) = 0 Then
Combo8 = DLookup("[NewENum]", "qryWhereNow")

What would I put in the place of (or preceeding) "Combo8" in order to have it correctly reference the proper subform field from the main form?

Thanks in advance :)
 
Sorry, I have the code as below, not as it is above (Forgot the "Me."):

If Nz(Me.Combo8, 0) = 0 Then
Combo8 = DLookup("[NewENum]", "qryWhereNow")
 
Since this is a question relating to forms, perhaps it would be better addressed in the forms forum?

Short one on terms, fields reside in tables, and might be available thru queries. Thingies on forms and reports are controls. Controls might be bound to fields, be unbound or have calculated controlsources.

That said, here's a link on How to Refer to a Control on a Subform or Subreport1.

Often one can refer to controls on a subform using the name of the subform:

[tt]me!frmsubform.Form!combo8[/tt]

But, as explained in the above link, it's the subform control name that's used in the reference, and it might differ from the subform name as viewed in the database window.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top