Results 1 to 6 of 6
  1. #1
    KCC47 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    77

    Append Query Current Record Only

    I need some assistance setting the criteria for an append query. After the user enters information on the transaction_entry_frm, then there is a command button that saves the record and is supposed to append the primary key, transaction_id, to an invoice_tbl. The command button should only append the current record, but I cannot seem to get that to work properly.



    The append query also has a expression to take fields from the transaction_tbl and concatenate them into a single field in the invoice_tbl.

    I would appreicate any asssitance.
    Attached Files Attached Files

  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
    Before I download and go on scavenger hunt through your db, why doesn't it work? What happens - error message, wrong results, nothing? Post the code for analysis.

    What objects are involved?
    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
    KCC47 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    77
    My apologies. The append inquiry is located on a command button in the transaction_entry_frm. When clicked, it appends all records to the invoice_tbl even if there are already there with matching transaction_id. It also indicates an error that there is a data type mismatch in the criteria expression.

    "[Forms]![Transaction_Entry_Frm]![Transaction_ID]"

    This is the criteria at present.

  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
    Tried opening the db, get 'Unrecognized database format'. My 2007 is not recognizing, don't have 2010 here.

    What is the code behind the button? Some questions can be quickly answered if the info is just provided up front. You show the control reference within quote marks. The reference to control is a variable. Don't enclose variables within quote marks, otherwise you just get the literal text of the variable name, not the value of the variable. Concatenate variables. Something like:

    CurrentDb.Execute "INSERT INTO Invoices(transaction_id) VALUES(" & [Forms]![Transaction_Entry_Frm]![Transaction_ID] & ")"


    I am distressed by "take fields from the transaction_tbl and concatenate them into a single field in the invoice_tbl". Why would you save discrete data as a concatenated string into a single field?


    If you are getting data type mismatch error, could be because of enclosing the control reference in quotes.
    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
    KCC47 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    77
    Removing the quotation marks seems to have fixed the issue.

    I needed a way to create an invoice # that would mean something to end users, so I choose to concatenate three pieces of informatoin, each of which have significance to the users.

    Thank you

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Okay, but if you are using an autonumber transaction ID as PK/FK, it is not necessary to duplicate those other fields. They can always be retrieved by query that joins on the ID fields and the compound identifier constructed when needed. But then again I guess it won't hurt for you to save as long as there is absolutely no way those 3 values will ever be edited, making the saved compound value meaningless.
    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. Query for current record
    By zooyo in forum Queries
    Replies: 3
    Last Post: 07-26-2013, 11:10 AM
  2. Append Query For Single Record
    By burrina in forum Forms
    Replies: 8
    Last Post: 01-04-2013, 05:12 PM
  3. Run query for current record only
    By lmh24 in forum Queries
    Replies: 3
    Last Post: 06-01-2012, 03:23 PM
  4. Current Record Value in query
    By A S MANN in forum Queries
    Replies: 3
    Last Post: 12-21-2011, 06:21 AM
  5. How to output only current record in query
    By mslieder in forum Access
    Replies: 0
    Last Post: 01-20-2006, 05:48 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