Results 1 to 10 of 10
  1. #1
    Divine is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    5

    Append Query and Auto Populate

    Hi,

    I have a tbl that gets populated from an append query and a form that is crated from this table. there is one field that gets populated from the append query called departments, the department names are long and we have abbreviated versions of the department names that I would like to use.



    In the table I have two columns “department” (for long name) and “updated department” (for abbreviated department name) When I use the append query to update the department (long name) I want the abbreviated department column to populate.

    for example if department column reads "Drilling and Workover" from the append query, I want updated department column to slefpopulate to read "D&WO"
    I want the updated department field to automatically fill with the abbreviated name. How do I do this?
    Last edited by Divine; 12-25-2013 at 04:09 AM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Why are you using an append query anyway? Why are you duplicating the department name into the destination table? Should just save the primary key (abbreviated name?) from the departments table.

    What is the source of the data for the append? Why can't you just include the abbreviated column? Post the query for analysis.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Divine is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    5
    I'm using anappend query because the data comes from an external source and the externalsource is not willing to change their data for me. I append there info to mytable and then I want to change it to an abbreviated format.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Got it, had to read the original thread again.

    Can run an UPDATE query after the append.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Divine is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    5
    ok let me try that

  6. #6
    Divine is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    5
    Sorry man but Ihave never done this before. I'm not sure how to write the expression thatchanges multiple department names to an abbreviated form using an update query.The update query appears to be changing all the department names to onedepartment. in the criteria I tried "if Drilling and Workover" then "D&WO" butthat didnt work. I'm lost here man. I'm sure its something easy.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Sorry, I thought you already had the abb names in a "Departments" table and want to add them to another table where data is imported into with long names. If you don't already have the abb names available for reference then you cannot do this. No way can Access know that "Drilling and Workover" should be abbreviated as D&WO. Can't read minds.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    Divine is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    5
    Well I was ableto do the below code on the form I'm working in and it kind of worked except it wants to populate everyrecord with the same abbreviation when I click on the field [text62] I want itto populate automatically not on click and be specific to each record. Any thoughts?

    Private Sub text62_click()
    If [Dept] = "Southern Area Oil Drilling Department" Then
    [Text62] = "SAODD"
    ElseIf [Dept] = "Drilling &Workover Services Department" Then
    [Text62] = "D&WSD"
    ElseIf [Dept] = "Exploration Drilling Department" Then
    [Text62] = "EDD"

    End If
    End Sub


  9. #9
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Perhaps you could use your code in the After Update event of [Dept]
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    That isn't going to work for records that already exist.

    Are these the only names you will ever have to be concerned with - only 3 names? If you want to do a mass update of many records at one time, one method is an UPDATE sql action. In VBA I would try:

    CurrentDb.Execute "UPDATE tablename SET AbbName = Switch([Dept]='Southern Area Oil Drilling Department', 'SAODD', [Dept]='Drilling & Workover Services Department', 'D&WSD', [Dept]='Exploration Drilling Department', 'EDD')"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 5
    Last Post: 02-05-2013, 10:57 PM
  2. Replies: 3
    Last Post: 11-19-2012, 12:27 PM
  3. Auto populate tbl
    By fodzilla in forum Access
    Replies: 3
    Last Post: 06-15-2012, 05:03 PM
  4. Auto Append data from another database
    By Eagle2012 in forum Import/Export Data
    Replies: 1
    Last Post: 03-07-2012, 07:05 PM
  5. Auto Populate
    By co_sportsguy in forum Access
    Replies: 3
    Last Post: 09-01-2010, 01:22 PM

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