Results 1 to 3 of 3
  1. #1
    MFS is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2009
    Location
    Ohio
    Posts
    235

    Same Part number, two different vendors

    Good morning,
    I've built a small database for our MRO inventory which has been working quite well. I'm now running into a request from the data entry employee requesting that when he queries a part number something should inform him that he has two + vendors that carry the same part number. I allow the database to have duplicate part numbers so that is okay but he is requesting a message box appear when he searches one of those part numbers to inform him of 'X' amount of vendors. I would have to then show who.
    Could someone help me with this?



    Mike

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Technically speaking, if a part can be supplied by more than one vendor and a vendor can supply many parts to you, that describes a many-to-many relationship which is routinely handled with 3 tables as follows:

    tblParts (ony 1 record per part number in this table)
    -pkPartID primary key, autonumber
    -PartNo

    tblVendors
    -pkVendorID primary key, autonumber
    -txtVendorName

    tblPartVendors (each part can have many records in this table--one for each supplier)
    -pkPartVendorID primary key, autonumber
    -fkPartID foreign key to tblParts
    -fkVendorID foreign key to tblVendors
    -PartCost

    With the above structure, what you user want to be able to do is possible

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    To determine if there is more than one supplier ofr a given part, assuming that there is one Record per Vendor per Part,

    If the part number is defined as a Number Datatype:
    Code:
    If DCount("*","TableName", "PartNum = " & Me.SearchBoxName)> 1 Then
     Msgbox "There are Multiple Suppliers for this Item!"
    End If

    If the part number is defined as a Text Datatype:
    Code:
    If DCount("*","TableName", "PartNum = '" & Me.SearchBoxName & "'")> 1 Then
     Msgbox "There are Multiple Suppliers for this Item!"
    End If

    replacing TableName with the actual name of the Table that holds the data, PartNum with the actual name of the Field, in the Table, that holds that piece of data, and SearchBoxName with the name of the Control, on the Form, that holds the number to be searched for.

    You could then have, perhaps, a small Subform, or perhaps a Listbox, sourced by a SQL statement, using the same Criteria, to return all appropriate Records.

    Linq ;0)>

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

Similar Threads

  1. Increment part of a serial number
    By swavemeisterg in forum Forms
    Replies: 10
    Last Post: 04-15-2013, 01:59 PM
  2. Replies: 2
    Last Post: 04-13-2011, 09:42 AM
  3. Adding Part Number on demand that is not in table
    By patrickwelch in forum Programming
    Replies: 4
    Last Post: 03-21-2011, 07:53 PM
  4. Part Number Lookup
    By jacobbiljo in forum Queries
    Replies: 1
    Last Post: 11-12-2009, 09:22 AM
  5. Multiple Part Number Look=up
    By nywi6100 in forum Reports
    Replies: 0
    Last Post: 09-27-2006, 11:38 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