Requery unbound combobox on mainform (1 Viewer)

ngsabath93

Registered User.
Local time
Today, 08:00
Joined
Jun 30, 2014
Messages
48
I have a form "Clientfrm" with a field, "ClientID".
I have another form, "HomePage", with an unbound combobox with rowsource "ClientID" from Clientfrm. Along with that, I have an Open Form button that pops up "Clientfrm" to display existing data if an existing ClientID is typed.
SITUATION: A nonexistant ClientID is typed into "HomePage", a blank "Clientfrm" pops up with the field "ClientID" blank on the Clientfrm. Once filled out and closed, I am back to the "Homepage" to enter another "ClientID". However, the combobox does not display the new "ClientID" until the "Homepage" is closed and reopened. How do I fix this?

I tried the Me.ClientID.Requery on the On change event of the combobox of the "Homepage", but that is not working. What should I do? SHould I instead put that code in on change event in the "ClientID" field in the "Clientfrm?" Thanks!!
 

vbaInet

AWF VIP
Local time
Today, 13:00
Joined
Jan 22, 2010
Messages
26,374
Save the newly added record before opening the form:
Code:
If Me.Dirty Then Me.Dirty = False
 

ngsabath93

Registered User.
Local time
Today, 08:00
Joined
Jun 30, 2014
Messages
48
Save the newly added record before opening the form:
Code:
If Me.Dirty Then Me.Dirty = False
WHich Event AND which form's field do I put this in? And does it matter that my combobox is unbound?
 

vbaInet

AWF VIP
Local time
Today, 13:00
Joined
Jan 22, 2010
Messages
26,374
Like I said before, save the record before you open the form. I gave you the code for saving the record.
 

ngsabath93

Registered User.
Local time
Today, 08:00
Joined
Jun 30, 2014
Messages
48
IM sorry I am a beginner at VBA. Where do I put this code?? ok I am in design view of "Homepage" and on the property sheet of the unboound combobox. I am at the event tab. Where do i place this code?
 

ngsabath93

Registered User.
Local time
Today, 08:00
Joined
Jun 30, 2014
Messages
48
Next to this combo box, i have a button I created from the wizard that opens Clientfrm.
 

vbaInet

AWF VIP
Local time
Today, 13:00
Joined
Jan 22, 2010
Messages
26,374
Go behind the Click event and put the code before it opens the form.
 

ngsabath93

Registered User.
Local time
Today, 08:00
Joined
Jun 30, 2014
Messages
48
i put in on the on-click event of the unbound combobox on the homepage and nothing happened.
 

ngsabath93

Registered User.
Local time
Today, 08:00
Joined
Jun 30, 2014
Messages
48
I alread have a macro for the on click event to open Clientfrm. How do I place the code before it opens the form
 

vbaInet

AWF VIP
Local time
Today, 13:00
Joined
Jan 22, 2010
Messages
26,374
Convert the macro to VBA. There's a button for this, look into it.
 

vbaInet

AWF VIP
Local time
Today, 13:00
Joined
Jan 22, 2010
Messages
26,374
I don't need to see your db ngsabath93. If I do I'll ask.
 

Users who are viewing this thread

Top Bottom