By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,477 Members | 1,383 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,477 IT Pros & Developers. It's quick & easy.

Look up Text box Vs. Combo box

100+
P: 418
Look up Text Box Vs Combo Box

tblOrg has these fields
OrgID PK
OrgNo Text
OrgDescr Text

I would like to see the OrgNo get displayed in two other tables: tblExpense and tblRevenue from a drop down list on the forms that are based on these two tables, ie., tblExpese & tblRevenue

To include OrgID as one of the fields in these two tables, I first selected the data type to be a Number. When I tried to enter data, I get the error message that reads:

“The value you entered is not valid for this field. For example, you must have entered text in a numeric field…”

Of course I did.

What is the solution? Can somebody please help? Many thanks.
Apr 22 '09 #1
Share this Question
Share on Google+
9 Replies


missinglinq
Expert 2.5K+
P: 3,532
I'm sorry, but I've spent five minutes trying to understand your post. First you speak of wanting to include OrgNo in the other two tables, then you go on to talk about what you're doing to include OrgID in the tables.

You have OrdID marked as "PK" indicating Primary Key, but you don't say what datatype it is.

Clarification is needed here, but generally speaking, if you have a field in multiple tables, as PK and FKs, the datatypes have to be the same in each table. The only exception to this is if your PK is being generated by Access as an AutoNumber. In that case, the datatype for it in the tables where it will appear as a FK would have to be set to Number and Long.

Linq ;0)>
Apr 22 '09 #2

100+
P: 418
missingling:

My apologies for not being clear.

OrgID is a PK and the data type is auto number

Data type for OrgNo is text.

Now if I want to see a drop down list of OrgNo in a form (let’s call it frmExpense) which is based on a table called tblExpense – what field I add to this table to tie the OrgNo from the tblOrg?

Hope this makes it clear. If not, feel free to post your question.

Thanks for spending 5 preciouis minutes of your time to decipher my questions.

MNNovice
Apr 22 '09 #3

DonRayner
Expert 100+
P: 489
For the rowsource property of the listbox you would set it to this. Include the quotes.
Expand|Select|Wrap|Line Numbers
  1. "SELECT tblOrg.* FROM tblOrg;"
Set the listbox Bound Column Property to 1 (This would be the OrdID)
Set the listbox Column Count Property to 2
Set the listbox Column Widths Property to 0";1" (This will hide the OrdID column)

There you have it. Your listbox will show the OrgNo text but what gets entered into the record will be the OrgID number.

Hope this helps.
Don
Apr 22 '09 #4

100+
P: 418
Don:

Sorry to let you know it didn't work. I still got the same error message, "You may have entered text in a numeric field or a number that is larger than the field setting."

OrgID is PK and has an auto number data type
OrgNo has text data type with a field size of 20

I am trying to enter 4XXXX as a value for the organization on the form.

Any suggestions?
Apr 22 '09 #5

DonRayner
Expert 100+
P: 489
What is the field size setting for the field in the table that the listbox is bound to.
Apr 22 '09 #6

100+
P: 418
Don:

The problem is resolved now. I deleted the sub form and recreated the tblExpense and tblRevenue - that took care of it. Bizzare! Must be a Microsoft issue.

I need help with something else. tblAccounts has these fields

AccountID PK (Auto)
AccountNo Text
AccountDescr Text

In my expense or revenue form that are based on tblExpense and tblRevnue I would like the AccountDescr field to be automatically filled in once the AccountID is entered. How to do this? Can you provide some guidance?

Thanks.
Apr 22 '09 #7

DonRayner
Expert 100+
P: 489
If your AccountID field on your form is a list or combo box you could do something like I outlined in post #4 except set the column count property to 3 instead of 2. and change tblOrg to tblAccounts

Then in the after update event for the list/combo box you would put the following code.
Expand|Select|Wrap|Line Numbers
  1. Me.AccountDescr = me.AccountID.column(2)
Just change the values in the listbox Column Widths Property to 0 if you don't want them visible to the user. So if you want the ID visible but not the others it could be 1";0";0" or such.

Please note that when referring to the data contained in the list/combo box the columns are counted as 0,1,2 But when referring to the column that is "Bound" to the table they are counted as 1,2,3.

If you're not using a list/combo box we will have to ask one the the moderators to break this off into a new thread as it would become confusing to others searching the site for answers.
Apr 22 '09 #8

100+
P: 418
Don:

Beleive it or not, this morning that form went back to its bizzare mode meaning each time I tried to pull a AcctNo (a text field), I got the same error message. Well, I deleted the table (tblExpense and tblRevenue) and this time created new ones from the scratch. Everything seems to be working now. Hopefully I will not have to repeat this process in future.

Many thanks for your help with the auto fill part. I appreciate. I am going to close this thread and shall post new questions on new threads. Thanks again.
Apr 23 '09 #9

DonRayner
Expert 100+
P: 489
Glad I could help, good luck with your project.
Apr 23 '09 #10

Post your reply

Sign in to post your reply or Sign up for a free account.