Results 1 to 2 of 2
  1. #1
    thanosgr is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    56

    Cool Using Access VBA to check if the record exists in the table

    Hi
    Ive got a form with subform

    Main form consist of

    ProjectId
    Supplier
    Supervisor
    Date

    and in the subform
    Contains
    ProductNumber,Product Description, Stock, Price, Final Price.


    Now the form and subform works as insert

    What i want is to check if the productnumber exists, then the productdecription filled, and i insert values to stock, price, etc.
    If not, then we add a new product.

    I figure out with Recordsets. but where should i put the vba code?
    on Form Load?
    using after update into the product id?

    what is the best way to do it?



    Thanks

    PS any help with dummy code will be appreciate also

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    You could use a combobox with LimitToList Yes then users can only select a valid product number.

    Otherwise, a simple DLookup could verify if the item exists. However, if you want to move to the record if it exists, need to use RecordsetClone and Bookmarks or set Filter properties.
    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. Trouble with check if Exists before Edit or Add Record
    By mrfixit1170 in forum Programming
    Replies: 4
    Last Post: 02-10-2012, 10:38 AM
  2. Check to see if record id exists in joined table
    By csoseman in forum Programming
    Replies: 1
    Last Post: 08-18-2011, 01:06 PM
  3. Testing if a record exists on a Table
    By axess_nab in forum Queries
    Replies: 2
    Last Post: 06-14-2011, 12:27 PM
  4. How to test of record exists in table?
    By tdaccess in forum Access
    Replies: 3
    Last Post: 04-13-2011, 10:22 AM
  5. How to check if a node of a tree exists
    By weekend00 in forum Programming
    Replies: 2
    Last Post: 10-27-2010, 09:34 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