Comboboxes - clicking previous record show blanks

G

Guest

Hello -

I have cascading comboboxes that seem to working fine as long as data is
being entered. When I travel backwards through the records, though, all of
the comboboxes are blank. [Two tables - one with a sort of lookup column to
the detail table.]

Any ideas on how to fix this?
 
G

Guest

How did you limit the second combo list depending on the first one?

If the RowSource of the second combo include a reference to the first combo,
try and add to the OnCurrent event of the form
Me.Combo2Name.Requery

If you use the After update event of the first combo to assign a new
RowSource to the second combo, then try and run is code OnCurrent event of
the form
 
G

Guest

Thanks for your reply, Ofer.

I already had the requery in the afterUpdate event. I think my problem is
with the control source - rather I KNOW it is -- there is nothing there!
Since I posted, I have tried various things, but none of them work. I am
absolutely frustrated!

I have the following scenario:

tblCalls has a column for DeclarationID in it. That references
tblDeclaration which has DeclarationID, DeclarationNum, Declaration and
State. Right now I have a bunch of states in there, many of them repeating
and should probably be doing some sort of lookup column in tblDeclaration
referencing a new table, tblStates, but I haven't the foggiest on how to get
all of that synchronized in my comboboxes.

The comboboxes I have are cboState, cboDeclarationNum and a textbox,
txtDeclaration. cboState is populated with "Select Distinct State from
tblDeclaration" (I had to do it that way or there would be repeating states).


cboDeclarationNum is populated by "SELECT tblDeclaration.DeclarationID,
tblDeclaration.Declaration, tblDeclaration.DeclarationNum,
tblDeclaration.State FROM tblDeclaration WHERE
(((tblDeclaration.State)=[Forms]![frmCalls]![cboState]));". column count = 4,
column widths=0";0";.829;0" This is requeried in cboState_AfterUpdate as
"Forms![frmCalls]![cboDeclarationNo].Requery"

txtDeclaration is populated with cboDeclarationNum_AfterUpdate as:
"Me.txtDeclaration = Me.cboDeclarationNo.Column(1)" There is an additional
statement in cboDeclarationNum_AfterUpdate to tie it into the Declaration
with:
"Me.DeclarationID = Me.cboDeclarationNum.Column(0)"

What should my Control Source be? As you probably know, the only choices in
my dropdownlist are from tblCalls and the only related item is DeclarationID.

Any help will be GREATLY, GREATLY appreciated!

--
Sandy


Ofer said:
How did you limit the second combo list depending on the first one?

If the RowSource of the second combo include a reference to the first combo,
try and add to the OnCurrent event of the form
Me.Combo2Name.Requery

If you use the After update event of the first combo to assign a new
RowSource to the second combo, then try and run is code OnCurrent event of
the form

--
\\// Live Long and Prosper \\//
BS"D


Sandy said:
Hello -

I have cascading comboboxes that seem to working fine as long as data is
being entered. When I travel backwards through the records, though, all of
the comboboxes are blank. [Two tables - one with a sort of lookup column to
the detail table.]

Any ideas on how to fix this?
 
G

Guest

There are few things that I can think of, and I hope I'm not going to make
you more comfused

1. Why do you assign a value to DeclarationID?
Me.DeclarationID = Me.cboDeclarationNum.Column(0)
You can make the combo bounded to this field (Control source of the combo),
that way moving between records will refresh the selection in the combo

2. Run requery for cboDeclarationNum combo, on the OnCurrent event of the form

3. Assuming that you are not storing the txtDeclaration field in the table,
because there is no need to do that
Me.txtDeclaration = Me.cboDeclarationNo.Column(1)

Instead you can write in the control source of the text field
=[cboDeclarationNo].Column(1)
======================================
All of the above will refresh the display automatically, and you don't need
the code

Me.txtDeclaration = Me.cboDeclarationNo.Column(1)
Me.DeclarationID = Me.cboDeclarationNum.Column(0)
--
\\// Live Long and Prosper \\//
BS"D


Sandy said:
Thanks for your reply, Ofer.

I already had the requery in the afterUpdate event. I think my problem is
with the control source - rather I KNOW it is -- there is nothing there!
Since I posted, I have tried various things, but none of them work. I am
absolutely frustrated!

I have the following scenario:

tblCalls has a column for DeclarationID in it. That references
tblDeclaration which has DeclarationID, DeclarationNum, Declaration and
State. Right now I have a bunch of states in there, many of them repeating
and should probably be doing some sort of lookup column in tblDeclaration
referencing a new table, tblStates, but I haven't the foggiest on how to get
all of that synchronized in my comboboxes.

The comboboxes I have are cboState, cboDeclarationNum and a textbox,
txtDeclaration. cboState is populated with "Select Distinct State from
tblDeclaration" (I had to do it that way or there would be repeating states).


cboDeclarationNum is populated by "SELECT tblDeclaration.DeclarationID,
tblDeclaration.Declaration, tblDeclaration.DeclarationNum,
tblDeclaration.State FROM tblDeclaration WHERE
(((tblDeclaration.State)=[Forms]![frmCalls]![cboState]));". column count = 4,
column widths=0";0";.829;0" This is requeried in cboState_AfterUpdate as
"Forms![frmCalls]![cboDeclarationNo].Requery"

txtDeclaration is populated with cboDeclarationNum_AfterUpdate as:
"Me.txtDeclaration = Me.cboDeclarationNo.Column(1)" There is an additional
statement in cboDeclarationNum_AfterUpdate to tie it into the Declaration
with:
"Me.DeclarationID = Me.cboDeclarationNum.Column(0)"

What should my Control Source be? As you probably know, the only choices in
my dropdownlist are from tblCalls and the only related item is DeclarationID.

Any help will be GREATLY, GREATLY appreciated!

--
Sandy


Ofer said:
How did you limit the second combo list depending on the first one?

If the RowSource of the second combo include a reference to the first combo,
try and add to the OnCurrent event of the form
Me.Combo2Name.Requery

If you use the After update event of the first combo to assign a new
RowSource to the second combo, then try and run is code OnCurrent event of
the form

--
\\// Live Long and Prosper \\//
BS"D


Sandy said:
Hello -

I have cascading comboboxes that seem to working fine as long as data is
being entered. When I travel backwards through the records, though, all of
the comboboxes are blank. [Two tables - one with a sort of lookup column to
the detail table.]

Any ideas on how to fix this?
 
G

Guest

Hi Ofer -

Thanks so much for replying again. When I bind DeclarationID to
cboDeclarationNo, nothing is displayed in cboDeclarationNo.

I tried putting =[cboDeclarationNo].Column(1) in the Control Source of
txtDeclaration and when you try to go to the next record, an error message is
displayed (something about read-only). The only way I can keep it as the
Source is to disable the textbox, which I suppose is okay, but it looks kind
of strange.

At any rate, I still can't go backwards and have the records display. Now
it is doing something different, however -- displaying the last state,
DeclarationNum and Declaration in each record that I selected in -- in other
words, if I pick something in the dropdown for state, then pick something for
DeclarationNum, continue filling in the record, then go back one record, the
previous record will show the same thing that I put into the current record
(although nothing is changed in the underlying table, Thank God).

Any other thoughts?

--
Sandy


Ofer said:
There are few things that I can think of, and I hope I'm not going to make
you more comfused

1. Why do you assign a value to DeclarationID?
Me.DeclarationID = Me.cboDeclarationNum.Column(0)
You can make the combo bounded to this field (Control source of the combo),
that way moving between records will refresh the selection in the combo

2. Run requery for cboDeclarationNum combo, on the OnCurrent event of the form

3. Assuming that you are not storing the txtDeclaration field in the table,
because there is no need to do that
Me.txtDeclaration = Me.cboDeclarationNo.Column(1)

Instead you can write in the control source of the text field
=[cboDeclarationNo].Column(1)
======================================
All of the above will refresh the display automatically, and you don't need
the code

Me.txtDeclaration = Me.cboDeclarationNo.Column(1)
Me.DeclarationID = Me.cboDeclarationNum.Column(0)
--
\\// Live Long and Prosper \\//
BS"D


Sandy said:
Thanks for your reply, Ofer.

I already had the requery in the afterUpdate event. I think my problem is
with the control source - rather I KNOW it is -- there is nothing there!
Since I posted, I have tried various things, but none of them work. I am
absolutely frustrated!

I have the following scenario:

tblCalls has a column for DeclarationID in it. That references
tblDeclaration which has DeclarationID, DeclarationNum, Declaration and
State. Right now I have a bunch of states in there, many of them repeating
and should probably be doing some sort of lookup column in tblDeclaration
referencing a new table, tblStates, but I haven't the foggiest on how to get
all of that synchronized in my comboboxes.

The comboboxes I have are cboState, cboDeclarationNum and a textbox,
txtDeclaration. cboState is populated with "Select Distinct State from
tblDeclaration" (I had to do it that way or there would be repeating states).


cboDeclarationNum is populated by "SELECT tblDeclaration.DeclarationID,
tblDeclaration.Declaration, tblDeclaration.DeclarationNum,
tblDeclaration.State FROM tblDeclaration WHERE
(((tblDeclaration.State)=[Forms]![frmCalls]![cboState]));". column count = 4,
column widths=0";0";.829;0" This is requeried in cboState_AfterUpdate as
"Forms![frmCalls]![cboDeclarationNo].Requery"

txtDeclaration is populated with cboDeclarationNum_AfterUpdate as:
"Me.txtDeclaration = Me.cboDeclarationNo.Column(1)" There is an additional
statement in cboDeclarationNum_AfterUpdate to tie it into the Declaration
with:
"Me.DeclarationID = Me.cboDeclarationNum.Column(0)"

What should my Control Source be? As you probably know, the only choices in
my dropdownlist are from tblCalls and the only related item is DeclarationID.

Any help will be GREATLY, GREATLY appreciated!

--
Sandy


Ofer said:
How did you limit the second combo list depending on the first one?

If the RowSource of the second combo include a reference to the first combo,
try and add to the OnCurrent event of the form
Me.Combo2Name.Requery

If you use the After update event of the first combo to assign a new
RowSource to the second combo, then try and run is code OnCurrent event of
the form

--
\\// Live Long and Prosper \\//
BS"D


:

Hello -

I have cascading comboboxes that seem to working fine as long as data is
being entered. When I travel backwards through the records, though, all of
the comboboxes are blank. [Two tables - one with a sort of lookup column to
the detail table.]

Any ideas on how to fix this?
 
G

Guest

Hi again -

Do I have to hook cboDeclarationNum up to the main table, which is tblCalls?
tblCalls stores all of the other stuff on the form, plus it has a lookup
column; DeclarationID. If so, how do I do that?
--
Sandy


Ofer said:
There are few things that I can think of, and I hope I'm not going to make
you more comfused

1. Why do you assign a value to DeclarationID?
Me.DeclarationID = Me.cboDeclarationNum.Column(0)
You can make the combo bounded to this field (Control source of the combo),
that way moving between records will refresh the selection in the combo

2. Run requery for cboDeclarationNum combo, on the OnCurrent event of the form

3. Assuming that you are not storing the txtDeclaration field in the table,
because there is no need to do that
Me.txtDeclaration = Me.cboDeclarationNo.Column(1)

Instead you can write in the control source of the text field
=[cboDeclarationNo].Column(1)
======================================
All of the above will refresh the display automatically, and you don't need
the code

Me.txtDeclaration = Me.cboDeclarationNo.Column(1)
Me.DeclarationID = Me.cboDeclarationNum.Column(0)
--
\\// Live Long and Prosper \\//
BS"D


Sandy said:
Thanks for your reply, Ofer.

I already had the requery in the afterUpdate event. I think my problem is
with the control source - rather I KNOW it is -- there is nothing there!
Since I posted, I have tried various things, but none of them work. I am
absolutely frustrated!

I have the following scenario:

tblCalls has a column for DeclarationID in it. That references
tblDeclaration which has DeclarationID, DeclarationNum, Declaration and
State. Right now I have a bunch of states in there, many of them repeating
and should probably be doing some sort of lookup column in tblDeclaration
referencing a new table, tblStates, but I haven't the foggiest on how to get
all of that synchronized in my comboboxes.

The comboboxes I have are cboState, cboDeclarationNum and a textbox,
txtDeclaration. cboState is populated with "Select Distinct State from
tblDeclaration" (I had to do it that way or there would be repeating states).


cboDeclarationNum is populated by "SELECT tblDeclaration.DeclarationID,
tblDeclaration.Declaration, tblDeclaration.DeclarationNum,
tblDeclaration.State FROM tblDeclaration WHERE
(((tblDeclaration.State)=[Forms]![frmCalls]![cboState]));". column count = 4,
column widths=0";0";.829;0" This is requeried in cboState_AfterUpdate as
"Forms![frmCalls]![cboDeclarationNo].Requery"

txtDeclaration is populated with cboDeclarationNum_AfterUpdate as:
"Me.txtDeclaration = Me.cboDeclarationNo.Column(1)" There is an additional
statement in cboDeclarationNum_AfterUpdate to tie it into the Declaration
with:
"Me.DeclarationID = Me.cboDeclarationNum.Column(0)"

What should my Control Source be? As you probably know, the only choices in
my dropdownlist are from tblCalls and the only related item is DeclarationID.

Any help will be GREATLY, GREATLY appreciated!

--
Sandy


Ofer said:
How did you limit the second combo list depending on the first one?

If the RowSource of the second combo include a reference to the first combo,
try and add to the OnCurrent event of the form
Me.Combo2Name.Requery

If you use the After update event of the first combo to assign a new
RowSource to the second combo, then try and run is code OnCurrent event of
the form

--
\\// Live Long and Prosper \\//
BS"D


:

Hello -

I have cascading comboboxes that seem to working fine as long as data is
being entered. When I travel backwards through the records, though, all of
the comboboxes are blank. [Two tables - one with a sort of lookup column to
the detail table.]

Any ideas on how to fix this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top