Newbie SQL Dilemma

Newbie SQL Dilemma

am 09.11.2007 00:16:01 von tbrogdon

I have table Workstations with fields WorkstationID (autonum PK) and
WorkstationName (text). I also have table ProductOperation with
WorkstationID (long integer) as a foreign key. This is a 1 to many
relationship.

My goal is to have a combo box on a form based on the ProductOperation
table that shows the name of the Workstation (WorkstationName) NOT the
number for WorkstationID.

I have selected the ProductOperation table and used autoform on it. I
changed the default text box to combo box.

I went to the lookup properties of ProductOperation.WorkstationID and
changed the Row Source to SELECT Workstation.WorkstationID,
Workstation.WorkstationName FROM Workstation.

When I go back to the form the only the Workstation IDs show up in the
combo box.

So I go back to ProductOperation.WorkstationID and change the lookup
display control back to text box which eliminates the Row Source
identifier - I assume.

Then I go back and autoform ProductOperation table again; select the
WorkstationID text box; right click and change it to a combo box;
right clicka again and select properties and add the following SQL to
the Row SOurce field: SELECT Workstation.WorkstationID,
Workstation.WorkstationName FROM Workstation. This also just returns
the WorkstationIDs which mean nothing to anyone.

I need help.

Thanks,

Tim

Re: Newbie SQL Dilemma

am 09.11.2007 00:48:27 von tbrogdon

I should also note that I want to return the numeric value of
WorkstationID to the field ProductOperation.WorkstationID but I want
the user to view the string from Workstation.WorkstationName in the
combo box on the form created by using Autoform on table
ProductOperation specifically on the ProductOperation.WorkstationID
field.

TIA

TIm

Re: Newbie SQL Dilemma

am 09.11.2007 15:36:43 von none

wrote in message
news:1194565707.482946.207950@i38g2000prf.googlegroups.com.. .
> I should also note that I want to return the numeric value of
> WorkstationID to the field ProductOperation.WorkstationID but I want
> the user to view the string from Workstation.WorkstationName in the
> combo box on the form created by using Autoform on table
> ProductOperation specifically on the ProductOperation.WorkstationID
> field.
>
> TIA
>
> TIm
>

Your SQL looks OK, go to your combo box and edit the properties.
The query is retuning 2 columns so set "Column Count" to 2
The 1st column is returning the value you want to save so set "Bound Column"
to 1
You don't want the users to see the ID so hide the column with "Column
Width"
0";1.875" will hide the 1st column and set the 2nd to 1.875 inch wide

Re: Newbie SQL Dilemma

am 09.11.2007 18:40:29 von tbrogdon

Thanks Ron. That got it.

Tim