By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,155 Members | 2,518 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,155 IT Pros & Developers. It's quick & easy.

Unbound Combobox not displaying data as expected ... need HELP, please.

P: n/a

Greetings!

Still the same application (as previous posts). I worked on the app
while at work (don't tell my boss ... cause this is just for fun and not
work related) and the form was working, but now when I try to repeat the
code at home (for real) it won't work. I suspect that I haven't
replicated the logic and forms at home from what I remember that I did
while at work.

My subform is based on a table called "tblTrialClass" and it has a bound
control called [classID]. [classID] is a FK from "tblClasses". The
values are 1, 2, 3 representing the text "Novice", "Open", "Utility".
The [classID] control's VISIBLE property is set to False.
The subform, also, has an unbound combobox called [cboClass]. The
recordsource is:

SELECT tblClasses.classID, tblClasses.class
FROM tblClasses
ORDER BY tblClasses.classID;

First column has a width of 0", so the dropdown only shows the text.
Bound column is the first column (classID).

The table called "tblClasses" has two columns: classID (autonumber, key)
and class (text).

The subform has the following VBA code behind it:

Private Sub cboClass_AfterUpdate()
Me![classID] = Me!cboClass.Column(0)
End Sub

Private Sub cboJudge_AfterUpdate()
Me![judgeID] = Me!cboJudge.Column(0)
End Sub

Private Sub Form_Current()
Me![cboClass] = Me![classID]
Me![cboJudge] = Me![judgeID]
End Sub

(I haven't mentioned the Judge fields, but they have the same problem)

When the form is opened, whether dynamically by the outter parent form,
or manually by me when testing the subform; [cboClass] has "Novice"
displaying for all records, even though the value of [classID] is not
always = 1. I tested this out by making the [classID] visible to verify
the data.

QUESTION:
How do I synchronize the combobox data with the bound integer field
[classID]?

I am pulling my hair out on this one. It's so simple, I'm sure.

Thanks,
SueB
*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
rkc
Susan Bricker wrote:
Greetings!

Still the same application (as previous posts). I worked on the app
while at work (don't tell my boss ... cause this is just for fun and not
work related) and the form was working, but now when I try to repeat the
code at home (for real) it won't work. I suspect that I haven't
replicated the logic and forms at home from what I remember that I did
while at work.

My subform is based on a table called "tblTrialClass" and it has a bound
control called [classID]. [classID] is a FK from "tblClasses". The
values are 1, 2, 3 representing the text "Novice", "Open", "Utility".
The [classID] control's VISIBLE property is set to False.
The subform, also, has an unbound combobox called [cboClass]. The
recordsource is:

SELECT tblClasses.classID, tblClasses.class
FROM tblClasses
ORDER BY tblClasses.classID;

First column has a width of 0", so the dropdown only shows the text.
Bound column is the first column (classID).

The table called "tblClasses" has two columns: classID (autonumber, key)
and class (text).

The subform has the following VBA code behind it:

Private Sub cboClass_AfterUpdate()
Me![classID] = Me!cboClass.Column(0)
End Sub

Private Sub cboJudge_AfterUpdate()
Me![judgeID] = Me!cboJudge.Column(0)
End Sub

Private Sub Form_Current()
Me![cboClass] = Me![classID]
Me![cboJudge] = Me![judgeID]
End Sub

(I haven't mentioned the Judge fields, but they have the same problem)

When the form is opened, whether dynamically by the outter parent form,
or manually by me when testing the subform; [cboClass] has "Novice"
displaying for all records, even though the value of [classID] is not
always = 1. I tested this out by making the [classID] visible to verify
the data.

QUESTION:
How do I synchronize the combobox data with the bound integer field
[classID]?


Get rid of your unbound controls.

Make your classID control a combobox instead of a textbox. Keep it
bound to the classID field, make it visible, set it's rowsource
property to tblClasses, colum count to 2 and column widths to 0;1.

That's all there is to it. You don't need your afterupdate or current
events code. Access handles the updates and displays the correct text
for you.

Nov 13 '05 #2

P: n/a

rkc,

Thank you for your input and patience. Your suggestions worked. Now I
can get on with the rest of my day!!! (I was going to stick with this
until I got it to work). Maybe I shouldn't thank you ... I have lots of
housecleaning and errands to do.

Thanks again.
Regards,
SueB
*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.