473,395 Members | 1,680 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,395 software developers and data experts.

Setting Controls from a Table in Access 97

Bob
I have a form with controls City and Zip Code, and a Table containing Zip Code
with the corresponding City. I would like the user to just enter Zip Code,
either by typing or with a combo box; then have the city set automatically.
Any advice on how to do this would be appreciated.

Nov 12 '05 #1
5 1375
combobox example:

the columns in the combo would be:

zip
city
state

to get the city and state of the selected zip do this onexit, ondblclick or
whenever you need to set city and state

ctlCITYSTATE = ctlzipcode.column(1) & ", " & ctlzipcode.column(2) ' it's
zero based
code example

dim myset as recordset
set myset = currentdb().openrecordset("select city, state form ZipCodes
where zipcode = '" & ctlzipcode & "'",dbopensnapshot)

if myset.recordcount = 0 then
msgbox ctlzip & " is not on file"
else
ctlcitystate = myset!city & ", " & myset!state"
endif

close, etc.

John Bickmore
www.BicycleCam.com
www.Feed-Zone.com

"Bob" <Bo*******@att.net> wrote in message
news:kn***********************@bgtnsc04-news.ops.worldnet.att.net...
I have a form with controls City and Zip Code, and a Table containing Zip Code with the corresponding City. I would like the user to just enter Zip Code, either by typing or with a combo box; then have the city set automatically. Any advice on how to do this would be appreciated.

Nov 12 '05 #2
Bob
Thanks for your help. However, when I try your suggestion from the Combo
Box, I get a popup error message:

The value you entered isn't valid for this field.

The City control I'm trying to set is bound to a text field in a table,
which is the same length as the Combo Box City field.. Where did I go
wrong? Thanks for any additional help.
Nov 12 '05 #3
it sounds like you are assigning a string to a number field

John Bickmore
www.BicycleCam.com
www.Feed-Zone.com

"Bob" <Bo*******@att.net> wrote in message
news:KJ***********************@bgtnsc04-news.ops.worldnet.att.net...
Thanks for your help. However, when I try your suggestion from the Combo
Box, I get a popup error message:

The value you entered isn't valid for this field.

The City control I'm trying to set is bound to a text field in a table,
which is the same length as the Combo Box City field.. Where did I go
wrong? Thanks for any additional help.

Nov 12 '05 #4
oops, didn't finish the reply. or the value being assigned is failing a
validation

Look in:

table: design the table and select the field ( ex CITY ) and then
look at the "Validation Rule" and see if any of the value violate that rule

Form: similar, select the textbox and then in the data tab, look at the
"Validation Rule" and see if any of the values violate that rule, or you may
have code somewhere else that is causing the message such as a validation in
the BeforeUpdate event.
John Bickmore
www.BicycleCam.com
www.Feed-Zone.com

"xzzy" <mr********@comcast.net> wrote in message
news:3mIEb.402339$Dw6.1250211@attbi_s02...
it sounds like you are assigning a string to a number field

John Bickmore
www.BicycleCam.com
www.Feed-Zone.com

"Bob" <Bo*******@att.net> wrote in message
news:KJ***********************@bgtnsc04-news.ops.worldnet.att.net...
Thanks for your help. However, when I try your suggestion from the Combo Box, I get a popup error message:

The value you entered isn't valid for this field.

The City control I'm trying to set is bound to a text field in a table,
which is the same length as the Combo Box City field.. Where did I go
wrong? Thanks for any additional help.


Nov 12 '05 #5
Bob
Yes, it does imply that I'm putting text into a number field. I defined the
City control by dragging the City field from the associated Query. The City
field in the table referenced by the query is defined as text and is longer
that the corresponding field in the Combo Box table. Is my problem maybe
associated with having the Query between the table and the Form? The City
field comes from the second table defined in the Query and the fields are
included with the Table* usage. Again, thanks for your help.
Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Gary Hasler | last post by:
I have a full page of thumbnails linked to home plan pages. I'm adding a mouseover/mouseout effect to the table cells, plus a onclick event to permanently set the cell background to indicate the...
5
by: dixie | last post by:
I want to be able to set the font size and font type for text in a text box on a report using VBA. I wan't to be able to control it from a setting in a table. The problem is that I don't know the...
3
by: CSDunn | last post by:
Hello, I currently have an Access 2003 ADP Report/Subreport set up in which I have 12 subreports in a single main report that are located in a group header called 'PermnumHeader' (Permnum would be...
18
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on...
3
by: Anonymous | last post by:
Hello, in my init I am adding some controls into a placeholder. The complete procedure looks like this: Dim iLoop As Integer = 0 Dim table As New Table table.BackColor =...
5
by: Amelyan | last post by:
How can I get state of dynamically created controls (RadioButton, CheckBox, TextBox.Text) on post back when I click submit button? The only way I know is by traversing Response.Form enumberator;...
3
by: Nick | last post by:
Hi, I have some simple html: <table> <tr> <td background="~/images/category_background.jpg" runat=server></td> </tr> </table>
0
by: comp974 | last post by:
ok, here is the situation, I am trying to construct a table with several ASP.net 2.0 controls in it during execution time in an VB.net enviroment. For starters, I have a textbox and a linkbutton...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
3
by: Andreas Wöckl | last post by:
Hi Group! I have a web form that is created dynamically - so I create Textboxes, RadioButtonLists, CheckBoxLists and so on - I have found some articles that there may be some problems with...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.