Results 1 to 3 of 3
  1. #1
    DaniePosthumus is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2014
    Posts
    2

    Check if part selected in combo box has associated record in another table

    Hi

    My database has the following tables and fields regarding parts and associated bills of materials:

    -tblParts


    PartID, PartName etc.
    -tblBOMS
    PartID, ComponentID, ComponentName, Qty etc

    I also have a form - frmPickList - where the user capture certain data which is written to a table - tblBOMPickList. There is a command button for printing once the data is captured which generates a picking slip for the shop floor which tells them which part to manufacture (PartName) and which components to use and their quantity's (ComponentName, Qty)

    On the form -frmPickList - I have a combo box where the user can select the main part. The idea is that the report used for printing the pick list, retrieves the components from the query on which the report is based and it works fine as long as there is an associated record in tblBOMS.

    My problem is that I need to have a control that alerts the user if the main part selected in the dropdown combo box does not have components associated with it (in other words - it does not have a corresponding record in tblBOMS).

    I guess it will have to be a snippet of code in the 'After Update' property of the combo box but I'm completely clueless with VBA. What I need is a msg box to pop up alerting the user that there isn't a bill of material associated with the part selected and the user then has an option to open a new form from which a new bill of material can be added to the table tblBOMS on the fly.

    Can someone please help me with the VBA code to achieve this?

    Kind regards

    Danie

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    How about DLookup?
    http://support.microsoft.com/kb/208786

    You could use it in an If Else statement.

  3. #3
    DaniePosthumus is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2014
    Posts
    2
    Thank you very much!

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

Similar Threads

  1. Replies: 8
    Last Post: 06-26-2014, 08:52 AM
  2. Replies: 17
    Last Post: 11-05-2013, 04:19 AM
  3. Check if record is exits in table
    By adam23262 in forum Access
    Replies: 4
    Last Post: 02-08-2013, 01:00 PM
  4. How Can export Large table part by part
    By shabar in forum Import/Export Data
    Replies: 2
    Last Post: 02-04-2013, 06:29 AM
  5. Replies: 1
    Last Post: 03-06-2012, 06:45 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