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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Have A default Value Entered From A Combo? 2

Status
Not open for further replies.

number2

Technical User
Oct 25, 2001
284
US
I would like to have a default value, entered automatically in a feild which uses a lookup list. I hope I am being clear. The feild uses a Combo box to look up values from a lookup table. How can I have the feild automatically begin with a selected value?
 
number2,

I think this is what you're asking.....

Enter your selected value into the "Default value" property of the specific field, in the table design.

The default value will show up on any new record, whether it is on the table itself or a form.

Hope this helped.....

PMB [gorgeous]
 
Here is the problem; this database is to be distributed to others users who will have unique defaults (their name and contact info). I would like the lookup list to default to the first item in the list.
 
number2,

I did a little searching and came up with this.....

Specify which row is the default value in a list box or combo box
In a form, you can specify which row is automatically selected in a list box or combo box. This procedure does not apply to data access pages.
1. Open a form in Design view.
2. Make sure that the combo box is selected and then click Properties on the Form Design toolbar.
3. In the DefaultValue property box, type [comboboxname].ItemData(n) where n is the row that you want to use as the default. The ItemData property is zero-based, so type ItemData(0) if you want to make the first row in the list the default. For example, to specify the first row of the SupplierCombo combo box as the default for the combo box, type [SupplierCombo].ItemData(0) in the DefaultValue property box.
Note: If you want to specify a default value for a lookup combo box in Microsoft Access database (.mdb) table Design view, enter a default value in the DefaultValue property for the foreign key. For example, if you have a SupplierID foreign key (foreign key: One or more table fields (columns) that refer to the primary key field or fields in another table. A foreign key indicates how the tables are related.) in a Products table, click the SupplierID field, and then enter a valid supplier ID number in the DefaultValue property box in the lower portion of the window. The next time you add this Supplier ID field to a form, Access automatically sets the default value for the field.

..............Compliments of MS Access XP Help

lemeno,
PMB [thumbsup2]
 
Great Thanks so much! I am trying to give a star but it is erroring out. I tried to make that work for a long time, your solution works great!

On a different matter, on which I have posted several times; I need to design a large report but the report design view is not long enough to fit the feilds I need to add. I have maxed out the length of the design view. What do I do? How can I design a large report? Any help you can give would be great!
 
One last problem with the default combo selection; I have the combo box set to fill in several fields (address etc) when the selection is made. Using the default method, the other fields are not updating. Is there any way to make the default selection update to fill in the other feilds?
 
Hello number2,

On your report space matter. You really are only limited on space by the size paper you print to. Editing the page setup will give you more space (extending margins and page size). Once you have done that then just extend your workspace in design view. I inserted a pic, but when I view it, it's really huge....sorry

ReportGraphic.jpg


On to the other issue…

=DLookUp("[FieldName]","[TableName]","[ComboBoxName] = Forms![FormName]![ComboBoxName]")

I tried it and it worked for me. Type (fill in appropriate names) this into the other field's, that you want to automatically update, defult value property on the Data tab and you should be good to go.

Bueno?
PMB [2thumbsup]
 
Well...here's the problem; I have stretched the design view for the report as far as it goes to the bottom of the page. It does not go any further. (changing paper size in page setup is a separate issue I believe). When I pull the detail section to lengthen the design view it hit rock bottom and can go no further. Is this the limit of the report page design?
 
I just checked and you are right. I got up to 22". I would have to say, that's as big as it gets. Sorry I can't help with that one.

PMB [sad]
 
A thought....

You could just add fields into the forms/page footers and headers and extend them also.

hmm?
 
Good Idea! I will test that to see how the formatting comes out. I do have a footer, I will need to play with this a bit. I wonder how on earth you can create a long report?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top