ComboBox does not display values

B

Barry A&P

I have two comboboxes on a form that allow users to select Charge codes and
employee names. i have the combos row sources filtered so only active
employee names are available. or 2009 charge codes so the combo lists are not
so long. the issue i am having is that when a record is selected where the
employee that was previously selected is now inactive or the record has one
of last years charge codes the combo is blank and the user is rightfully
puzzled.. I know why this happens but i am not sure of a better way to go
about dealing with the data.. Last years records need to be visible but not
editable. and i only want new records to allow active employees or the
current years charge codes..

Any insight would be greatly appreciated

Thanks

Barry
 
J

Jeff Boyce

So you're saying that you want the form to display-only "old" records and
allow for addition of new records ...?

How will you (and Access) know which is which?

If you have a way to distinguish, one that you can "tell" Access, one
approach might be to add a toggle switch or some other mechanism that the
user can use to switch between records that are not updateable (and you can
therefore show the value in the combobox), and "current" records (including
adding new ones), which are updateable.

Is that what you're looking to do?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
B

Barry A&P

sJeff

Thanks for your response, i do not nessesarily have old records or current
records, all records are needed for possible updates and references, However
if a "new" record is created i want to limit the results of the two combos
combo1 to active employees and combo2 to this years charge codes.. can i
programatically filter the combos if the record is "new" or "Dated" this
year???


Thanks

Barry
 
D

Dale Fye

Barry,

In the forms Current event, test to see whether it is a new record. Then the
users will need to be able to select from the combo box, but for old records,
you might want to just display the values for those fields in a text box.
Something like:

Private Sub Form_Current

Dim bNewRec as boolean
bNewRec = me.NewRecord
me.txt_ChargeCode.Visible = not bNewRec
me.txt_EmployeeName.visible = not bNewRec
me.cbo_ChargeCode.visible = bNewRec
me.cbo_Employee.visible = bNewRec

End Sub

Of course, the text fields would have to get populated, you could either set
their control source to the same field as the combo box, or, if the bound
field is numeric, you could use the DLOOKUP function to populate those fields.
 

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