combo box text is blank

G

Guest

I have a timesheet form. I have fields jobNumber and WorkCodeID. JobNumber
has a description which displays only when selecting from the combo box. The
job number displays on the form. The workcodeID works a little different.
The workcodeID has a description which I want to display on the form, not the
id.

The code for my workcodeID combo box says display the description not the
code, but bind the combo box workcodeID to the form workcodeID. I hide the
workcodeID setting the column widths of the combo box to be 0cm;5cm etc.

Now when I load the form, the historical records for workcodeID are all
blank unless I set the column width to be 5cm;5cm in which case I see all the
workcodeID and not the description.

Is this some sort of ACCESS bug?

Has anyone seen a work around?
 
R

Rob Parker

Hi Peter,

I don't think it's any sort of bug, and there is no workaround required. It
seems that you've simply not got the row source (or perhaps some other
property) of your workcodeID combo-box set correctly.

From what you've posted, I'm assuming that you have a separate table of
workcodes, containing fields for WorkcodeID and Description. The Row Source
Type for the combo-box should read "Table/Query", and the Row Source entry
should be an SQL statement along the lines of:
SELECT tblWorkcodes.WorkcodeID, tblWrkcodes.Description FROM
tblWorkcodes;

The Control Source for the combo-box should be WorkcodeD (from the form's
recordsource - table or query). The bound column should be set to 1. Each
of these properties is accessed via the Data tab of the combo-box's property
sheet.

On the Format tab, make sure that theColumn Count is set to 2, and the
Column Widths to 0cm; 5cm.

And that should do it. Post back with more details (table/query names and
fields, and SQL of the form's recordsource and the combo-box's row source)
if that's not sufficient.

HTH,

Rob
 
G

Guest

Thanks Rob for the reply,

yes what you have said works, but the problem is that I want a condition on
the workcode. Employees are allocated specific workcodes from now on, so I
put employee in the workcode table and add the condition to the combo box
query and voila all the historical descriptions disappear. If I say display
the workcodeID it works but not the descriptions.
 
R

Rob Parker

Hi Peter,

I don't think I'm yet fully understanding exactly what you're trying to do.

What are the "historical desciptions"? If you have added an employee code
to the workcode table, you've probably got something wrong there; I suspect
that each employee has more than one workcode, and each workcode has more
than one employee. If so, you've got a many-to-many relationship, and
you'll need a junction table to store each of those combinations. And if
you've only just set up this additional relationship, you'll need to
populate that table with records for your "historical data".

If you want more help, please post details of your tables and their fields,
the Recordsource for your form (including the SQL if that is a query, rather
than a table, and the SQL statement for the row source for your combo-box.

Rob
 

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