DLookup form not refreshing

Locopete99

Registered User.
Local time
Today, 12:13
Joined
Jul 11, 2016
Messages
163
Hi Guys,

Need some help.

I have attached a picture of a form I'm working on. The form has two query subforms embedded in it. The top subform shows things that have an action required date of <= today.

The bottom has things that have a required action date of > today.

Clicking on either of these populates the main form using the ID number into ID (text2 on the form) and the rest are done by dlookups.

Code:
Forms!frm_mdtd!Text2 = Me.Id
Forms!frm_mdtd!Text4 = DLookup("CustNo", "Tbl_debt1", "ID=" & Me.Id)
Forms!frm_mdtd!Text6 = DLookup("CustName", "Tbl_debt1", "ID=" & Me.Id)
Forms!frm_mdtd!Text8 = DLookup("Type", "Tbl_aged", "ID=" & Me.Type)
Forms!frm_mdtd!Text10 = DLookup("Responsible", "Tbl_debt1", "ID=" & Me.Id)
Forms!frm_mdtd!Text12 = DLookup("Start", "Tbl_debt1", "ID=" & Me.Id)
Forms!frm_mdtd!Text14 = DLookup("Completed", "Tbl_debt1", "ID=" & Me.Id)
Forms!frm_mdtd!Text16 = DLookup("Notes", "Tbl_debt1", "ID=" & Me.Id)
Forms!frm_mdtd!Text26 = DLookup("NSA", "Tbl_debt1", "ID=" & Me.Id)
Forms!frm_mdtd!Text36 = DLookup("Contact", "Tbl_debt1", "ID=" & Me.Id)
Forms!frm_mdtd!Text38 = DLookup("Number", "Tbl_debt1", "ID=" & Me.Id)


This was the only way I could find to do this. I have 3 fields with an update button next to them, these just open a new form linked directly to the table to update required fields.

The problem comes when i need to update the main form after updating one of these links.

I have tried requery, refresh and also running the code again but cannot find a way to refresh the dlookup results.

Can anyone offer any ideas?
 

Attachments

  • form2.PNG
    form2.PNG
    33.8 KB · Views: 221
Instead of updating the subform controls using multiple DLookups I suggest you use an update query or sql to update the underlying table fields or an append query to insert a new record as appropriate.

Also is the subform linked to the main form using master/child fields?
 
Hi,

The sub forms are not connected to the main form. The sub forms are just to display the results of the query. If you click them it enters the id number onto the main form.

The table is updated by the "update" forms.

The main form is just to display the data, so i dont want to add another layer of adding data that is already working.

All i need is a way to have the main form "refresh" and update the dlookup values.
 
Hi. Pardon me for jumping in, but have tried Me.Recalc?
 

Users who are viewing this thread

Back
Top Bottom