Results 1 to 2 of 2
  1. #1
    justasking is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014

    beginner - populating a field with values based on another field's values

    i am new to access, sql and vba access.

    access table (Table1) has
    ID Gender NewGender
    1 male -
    2 female -
    3 males -

    I want the field Table1.NewGender to be populated with numerical codes 1 and 2 for males and females respectively based on Table1.Gender field.

    My visual basic editor has this:

    Sub recode()

    End Sub

    Could you pls start me off by giving me the VBA code i need to do this recoding that i can paste into the editor between sub recode and end sub


  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    I don't understand the question

    Are you trying to homogenize an existing set of data where people have typed in male, males, xmalex (where x can be any string of characters)?

    To do that you'd likely want a second table that has your 'allowable' genders (male or female) then run an update on your table1 rather than trying to update table 1 from other values in table 1

    Either way you shouldn't need code to do this you'd just have to run an update query for any GENDER that is LIKE *male* and update the NEWGENDER field to 1 then run a similar query for LIKE *female* and update NEWGENDER to 2

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 10-24-2013, 04:17 PM
  2. Summing Values Based On Other Field
    By JeffGeorge in forum Queries
    Replies: 9
    Last Post: 08-13-2013, 02:00 PM
  3. Replacing many values at once in a multiple values checkbox field.
    By ConfusedDatabaseDesigner in forum Forms
    Replies: 2
    Last Post: 07-20-2012, 08:58 AM
  4. Replies: 5
    Last Post: 06-14-2012, 08:30 AM
  5. Count of field based on specific values
    By tazzmann67 in forum Access
    Replies: 2
    Last Post: 03-30-2011, 09:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Other Forums: Microsoft Office Forums - Senior Forums