Results 1 to 4 of 4
  1. #1
    AKQTS is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jul 2010
    Posts
    56

    Error Checking my Entry Result

    It has been a while since I have worked in Access, but I am having a problem figuring out how to code this:

    A user enters a record into a form (temporary table). The program then looks for this record in an existing table and upates the remainder of the columns with the information entered.

    Temp_Table (user entry)
    -Serial Number (Key)
    -Job Number

    Main_Table (already defined)
    -Serial Number (Key)
    -Job Number (empty and updated form Temp_Table)


    What I want to do is:

    For Serial Number:
    -Have the program error on a serial number entered in Temp_Table that is not in Main_Table

    For Job Number:
    -In the case where Main_Table is empty it updates it with the Temp_Table value (completed).
    -If the Main_Table and Temp_Table Job Numbers are different (and Main is not null) an error message.
    -If the Main_Table and Temp_Table Job Numbers are different an error message.

    Any idea on where I can begin? Here is my code so far with no error messages or logic programmed. Thanks

    'Runs great, but no logic for errors

    Private Sub Append_Click()
    On Error GoTo Append_Click_Err

    With CodeContextObject
    DoCmd.RunCommand acCmdRefresh
    DoCmd.Echo True, ""
    DoCmd.SetWarnings False
    DoCmd.OpenQuery "Pouch_Info", acViewNormal, acEdit
    DoCmd.Close acQuery, "Pouch_info"
    'Queries values from temp_table
    DoCmd.OpenQuery "Pouch_Update", acViewNormal, acEdit
    'Updates main_table with temp_table values
    DoCmd.Close acQuery, "Pouch_Update"
    DoCmd.OpenReport "Pouch_Label", acViewNormal, "", "", acHidden
    DoCmd.Close acReport, "Pouch_Label"
    'Prints report for that record
    DoCmd.OpenQuery "Purge_After_Label", acViewNormal, acEdit
    'Clears temp_table
    DoCmd.Close acQuery, "Purge_After_Label"
    DoCmd.Requery ""
    End With

    Append_Click_Exit:
    Exit Sub
    Append_Click_Err:
    MsgBox Error$
    Resume Append_Click_Exit
    End Sub

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you considered working directly with the Main_Table and using a ComboBox to move to the SerialNumber record and the NotInList event of the cbo to add a new record?

  3. #3
    AKQTS is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jul 2010
    Posts
    56
    I have, but got my problems straightened out after this post.

    Cleaned up my code and am using DCount for my quick checking.

    Nice getting back into the swing of things!

    Thanks though

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Great! Do you want to use the Thread Tools and mark this thread as Solved?

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

Similar Threads

  1. Automatically checking a box?
    By Delta223 in forum Access
    Replies: 3
    Last Post: 01-10-2011, 10:37 PM
  2. Error Message re: data entry of date
    By Pro-not in forum Access
    Replies: 9
    Last Post: 10-22-2010, 10:14 AM
  3. Checking a table for changes
    By Rando in forum Queries
    Replies: 2
    Last Post: 10-07-2010, 09:25 AM
  4. Date error checking
    By oediaz in forum Programming
    Replies: 2
    Last Post: 03-26-2010, 12:08 PM
  5. Checking for Value in Query
    By jgelpi in forum Access
    Replies: 1
    Last Post: 06-24-2009, 04:57 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