Clearing a combo box based on another combox (1 Viewer)

RyLane

Registered User.
Local time
Today, 18:18
Joined
Feb 4, 2014
Messages
60
Hi,

I have a combo box (cbodate) and it's based on another combo box (cboagent). Right now when I select and agent, the date box shows the dates specific to that person and when I select one, I open a form with the info. The issue is when I want to select a new agent, the date box shows the old date until I select a new one. Is there a way to have the date combo go to a blank when a new agent is selected?

I have this right now in the afterupdate for the first box (cboagent)
Me.cboDate = Null
Me.cboDate.Requery
Me.cboDate = Me.cboDate.ItemData(0)

Thanks.
 

Sketchin

Registered User.
Local time
Today, 15:18
Joined
Dec 20, 2011
Messages
575
Me.cboDate.value = Null
Me.cboDate.Requery
Me.cboDate = Me.cboDate.ItemData(0)
 

RyLane

Registered User.
Local time
Today, 18:18
Joined
Feb 4, 2014
Messages
60
Didn't change anything by adding .Value
 

Sketchin

Registered User.
Local time
Today, 15:18
Joined
Dec 20, 2011
Messages
575
What if you comment out the last line? All that code is doing is defaulting to row zero of that record source.
 

RyLane

Registered User.
Local time
Today, 18:18
Joined
Feb 4, 2014
Messages
60
I copied that code from somewhere else, all I know is that when when I go to select another agent from the first combo box, the second one will get updated once that selection is made. Without the code, the second combo box stays on whatever was my first selection and will not update when I change the first one.
 

Sketchin

Registered User.
Local time
Today, 15:18
Joined
Dec 20, 2011
Messages
575
I'm not following. Do you want the second box to update? If I am understanding correctly, you want to update the second combo ONLY the first time you select an agent and want the 2nd combo to be "null" when you again select an agent?
 

RyLane

Registered User.
Local time
Today, 18:18
Joined
Feb 4, 2014
Messages
60
That is correct.

Update the second box to null/blank everytime a selection is made in the first box.
 

Users who are viewing this thread

Top Bottom