Combo box not refreshing??

access7

Registered User.
Local time
Today, 19:42
Joined
Mar 15, 2011
Messages
172
Hello all

I have been scratching my head with this one for a while and cannot work out what is going on, unfortunately I am still quite new to all of this and dont get as much time as I would like to work on it (it's kind of a side line project in my current job role - as a payroll assistant... quite different!)

Anyway, On Frm_Company and Frm_New Company I would like it so that once I have entered a new contacts name in the sub form (SubFrmContact) that persons name should then appear available to pick in the combo box (CboContact) at the bottom of the form (in Sub_FrmCorrespondence).

The combo box (CboContact) runs of a query (QrySearchContact)

I have tried a few things, for example, I thought a simple CboContact.Requery would work on losing focus of the surname field on the SubFrmContact, I have also tried a general refresh / requery of the combo box (CboContact) on the open / on load events of the sub form - none of which appear to be working.

I could be missing something really obvious here but it's driving me mad. I am hoping to get to a stage where I can demo my work so far to the MD but I know it will be one of the first things he picks up on!?

Can anybody help me???

If anyone needs any further info or I have not explained myself very well then please let me know - my database is attached...
Many Thanks in anticipation....:confused:
 

Attachments

If you are not specifically saving the new record, there would not be a new record to be displayed in the combo box.

Try adding the following code before the Me.CboContact.Requery statement:

Code:
If Me.Dirty then
     Me.Dirty = False
End If

This will check to see if there is new data and if so, it will save the record. The your requery should cause the new value to show in the combo box.
 
Thank you for your response, I have added in that code but am getting issues with having to enter parameter values... it is asking for the companyref - when I manually type in the companyref (which is an autonumber field in the tbl_Company) then the combo box does indeed refresh with the contact I have added.

Next question is... how do I automatically set this parameter value so that the end user does not have to type it in (the idea being that the companyref will be a hidden field that the user should never have to use / need to see)???

Thanks in anticipation for any replies....
 

Users who are viewing this thread

Back
Top Bottom