473,320 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Look up Text box Vs. Combo box

418 256MB
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
9 3156
missinglinq
3,532 Expert 2GB
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
MNNovice
418 256MB
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
489 Expert 256MB
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
MNNovice
418 256MB
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
489 Expert 256MB
What is the field size setting for the field in the table that the listbox is bound to.
Apr 22 '09 #6
MNNovice
418 256MB
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
489 Expert 256MB
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
MNNovice
418 256MB
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
489 Expert 256MB
Glad I could help, good luck with your project.
Apr 23 '09 #10

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

Similar topics

1
by: Mike | last post by:
I have a combo box and a text box. Text to be display will be contigent upon what is selected via the combo box. How do I do this? I put the following code in the text box object: var a =...
14
by: Norm | last post by:
Hi, Each time the user selects an item from a combobox, I want that string to get appended to the values that were already selected. The result is that the combo is accumulating text each time...
4
by: Mark L. Breen | last post by:
Hello Guys and Galls, I use combos on my forms. The code to initialise the combos is as follows Dim dsPIDTypes As DataSet dsPIDTypes = PartDB.GetPIDTypes ' Returns a dataset object...
1
by: bbcdancer | last post by:
Is it possible to restrict the length of a text box in MS Access using VBA on condition to what is selected in a list combo box. Scenario: 1. I have a list combo box containing: AA BBB...
3
by: chris | last post by:
I'm having trouble making this work: I have an unbound form with one unbound combo box field on it. The combo box's row source type is a query that has a username field and a security code...
1
by: dana1 | last post by:
I have a form with several combo boxes in the header used to determine the records that will be displayed on the form. When I tab or enter from the last combo box in the header, I want the focus to...
2
by: jw01 | last post by:
I have a form in which there is one combo box and three text boxes: Combo Box: -> Item A -> Item B -> Item C TextBox1: TextBox2: ...
2
by: SHAWTY721 | last post by:
I have a form that contains two combo boxes that are related to each other. I need to find a way to populate my text box based on the criteria of the two combo boxes so the appropriate number...
7
by: Brad Pears | last post by:
I have something strange going on - pretty sure it used to work before - and now it does not... Why does the following code not clear a combo box? Me.cboLocation.Text = String.Empty OR ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.