Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box List Values From Lookup Table

Status
Not open for further replies.

jgd12345

Technical User
Apr 22, 2003
124
GB
Hi, I have a form called frmHouses which displays the records from the Houses table. One of the fields is called outbuild. This field can take the value -1 or 0. -1 = yes, 0 = "" (blank). This is where I ge stuck because there is another table called Lookups which has 2 columns called fieldname and text. The important records in this table are one where the fieldname is outbuild and the text is Yes and another where the fieldname is outbuild and the text is "" (blank).

What I need todo is have a combo box which displays the values from the lookup table which is also bound to the field outbuild. I did this ok but when the combobox displays the records it doesn't make the ones where it is -1 set to yes and the ones where it's 0 set to "" (blank). Instead it displays the value -1 or 0.

I'd be greatful if someone could help. I'm sure it's pretty simple but has been troubling me all day.

Thanks
 
you can use VBA code.
But...
I'm not sure where you want the Yes and NO to appear.
In the combo box or in the form?


DougP, MCP, A+
 
Cheers, I want the yes/no to appear in the combo box. How would I go about doing it in vba?
 
Change the combo box properties to:

RowSourceType value list
ColumnCount 2
RowSource -1,"Yes",0,"No"
ColumnWidths 0,1
BoundColumn 1

If you have a desired default value, -1 or 0 i.e. yes or no, enter that in the default value space.

Try that.

Best,

C
 
Cheers worked a treat. One further thing I'm having trouble with is when I run the command DoCmd.OpenReport... it starts to print the report. Why won't it just open the report normally?
 
Try this:
DoCmd.OpenReport "YourReportName", acViewPreview

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top