Results 1 to 3 of 3
  1. #1
    Bcanfield83 is offline Advanced Beginner
    Windows 7 32bit Access 2016
    Join Date
    May 2018
    Posts
    81

    Question Import + append value passed from form

    Hi all,

    I'm looking to setup a file import process which also appends a variable number to one of the fields. The import itself is already setup - it's a simple .csv file which is imported via DoCmd.TransferText.
    There's a button in a form labeled "Import" which calls the import process. Thus, upon clicking the "Import" button,a function is called which imports the specified file into tblApp_Import. The file only contains 2 columns: one called "USERNAME", another called "TICKET". This table contains 4 total fields.

    -ID: AutoNumber (Primary Key)


    -USERNAME: Text
    -TICKET: Text
    -APP_ID: Integer

    So obviously the USERNAME and TICKET columns from the file are imported into the corresponding fields in this table. The APP_ID field is NOT on the file being imported.
    I need to populate that field with a numerical value corresponding with whichever Application is selected in the form (this is a basic List Box with a handful of choices - each of which has a specific numerical value).
    This number would need to be populated in the APP_ID field for every record that just imported. Thus if the table contains 30 records of USERNAME and TICKET, the APP_ID field would need to be populated with the number 12 for each of those 30 records.
    I'm thinking of just creating an APPEND query which passes that number from the form into the APP_ID field.. So this query would need to be executed separately, after the initial import
    Is there a more logical way to do this?

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I think you mean UPDATE rather than APPEND. It's quite common to have to do such operations in steps, so I don't see a problem. Probably is easier than trying to use subquery to get the value, but then there's domain lookup function as well. Many of these things introduce complication into your sql, and sometimes they're not possible or are just not worth the added effort and trial and error. For me, this one isn't a question of logical but of simplicity.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Bcanfield83 is offline Advanced Beginner
    Windows 7 32bit Access 2016
    Join Date
    May 2018
    Posts
    81
    Oops, my bad - it is indeed an "UPDATE" query, not "APPEND". Thank you!

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

Similar Threads

  1. Replies: 5
    Last Post: 12-11-2018, 05:52 AM
  2. Import Append
    By sdc1234 in forum Access
    Replies: 9
    Last Post: 05-07-2014, 02:00 PM
  3. Replies: 3
    Last Post: 01-18-2013, 11:44 AM
  4. Select Query with lookup params passed from form
    By sariahdog in forum Queries
    Replies: 0
    Last Post: 07-18-2011, 09:10 AM
  5. Form Data Not being passed onto query
    By fmoses in forum Queries
    Replies: 2
    Last Post: 08-20-2009, 08:33 AM

Tags for this Thread

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