473,403 Members | 2,338 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,403 software developers and data experts.

Using find and replace in different fields.

Hello everyone. I am trying to use access 2003 to see a word in one field and write a number in another field. Like if agree =3 , disagree= 1. I want access to see agree in a field and write 3 in another field. How can this be done?

For example if I had

Field 1 Field 2
Agree _____
disagree _____
agree _____
agree _____

I want access to realize that agree equals 3, and disagree equals 1
I want the result to look like

Field 1 Field 2
Agree 3
disagree 1
agree 3
agree 3


So in the end i only input the words strongly disagre, agree, disagree,
neutral, strongly agree (hate it, hate you...blah blah) (>^_^)>
and get whole numbers 1,2,3,4, or 5
Oct 5 '07 #1
7 1676
NeoPa
32,556 Expert Mod 16PB
Have you thought of using ComboBoxes with two columns - text and number columns. The text is displayed but the number is the associated value.
This seems ideal for your purpose.
Oct 5 '07 #2
No I have not I have little experience programming for access 2003. I was trying to self teach myself with a book.
Oct 5 '07 #3
NeoPa
32,556 Expert Mod 16PB
Would you like to check it out then?
You can let us know how you get on or if you find a problem with that (and what the problem is of course).
Oct 5 '07 #4
missinglinq
3,532 Expert 2GB
The advantage to NeoPa's suggestion is that the users get to select a comment, i.e. "agree" or "agree strongly" rather than having to type in an answer themselves.

You could use the AfterUpdate event for the comment field to assign the value to the second field,with something like this

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourCommentField_AfterUpdate()
  2.    Select Case YourCommentField
  3.         Case "Agree Strongly"
  4.      Me.CommentRatingField = 4
  5.        Case "Agree"
  6.          Me.CommentRatingField = 3
  7.        Case "Disagree"
  8.          Me.CommentRatingField = 2
  9.        Case "Disagree Strongly"
  10.          Me.CommentRatingField = 1
  11.        Case Else
  12.          Me.CommentRatingField = 0
  13.   End Select
  14. End Sub 
If the user then entered "Agree Strongly" the numerical field would be assigned the value 4. But if the user inadvertently entered "Strongly Agree" instead, an easy mistake to make, then the numerical field would be assigned the value of 0, which isn't what you intended! The combobox eliminates this type of mistake.

Welcome to TheScripts!

Linq ;0)>
Oct 5 '07 #5
NeoPa
32,556 Expert Mod 16PB
Very well expressed Linq.
That was indeed behind what I was saying :)
Oct 5 '07 #6
nico5038
3,080 Expert 2GB
Hmm,the "normalized" way to solve this would be to create an additional table with two fields filled with the description and the value:
Description, [FieldValue]
Agree, 1
Disagree, 2
etc...
This could be used to store directly the FieldValue by defining the Field1 in the table definition as a "Lookup" field that extracts the value from this new lookup table.
Another option will be to JOIN the lookup table by the Description to the lookup table and use the "joined" FieldValue for your needed final "table" that's effectively realised by a query.

Nic;o)
Oct 6 '07 #7
NeoPa
32,556 Expert Mod 16PB
Linq's post was illustrating the problems of doing it in a SELECT statement rather than suggesting it. The normalised way is indeed better, but if it's only used once I would find setting up a ComboBox with static entries quite acceptable.
Oct 6 '07 #8

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

Similar topics

4
by: Japhy | last post by:
Hello, I'm am pulling data from a mysql db and want to use the data to populate a <ul. Here are relavent parts of my code : $wohdate = mysql_result($wohRS,$wohndx,woh_date); $woh_display...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
4
by: Kathy | last post by:
What is the standard technique for handling the fields in the following scenario on a continuous form? Multiple Divisions. Each Division has multiple Buildings. Each Building has a Supervisor. ...
11
by: Dorsa | last post by:
HI, Could you please tell me the error in here. I am trying to open an XML file from a link. Response.Clear() Response.Expires = 0 Response.BufferOutput = False Response.ContentType =...
1
by: mark.heyden | last post by:
Hi Frends, I am facing problems while trying to export data into pipe format. In fact I am fetching records from mysql database and then trying to create a text file ( using pipe as delimeter) ,...
2
by: MR | last post by:
I would like to create an htm file (using Word) that will have some free form text. However, in the free form text I would like to be able to embed some fields like Name, Address, etc. I have tried...
0
by: AA Arens | last post by:
The Find and Replace dialog box has several fields (tab: Find): Find What Look In Match Search Match Case and Search Fields... How to set the defaults in Match with VB I use dour different...
2
by: Justin Fancy | last post by:
Hi everyone, I need some help. I'm placing text files into a created database using vb.Net. The problem is that, i need two seperate sql statements to add both files because they are in...
1
by: mr k | last post by:
Hi, I wanted to use mail merge with forms but Text form fields are not retained during mail merge in Word, I got the code from Microsoft but it doesn't remember the text form field options such as...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.