Access DLookup Function – more than 1 criteria

Access Discussion in 'Microsoft Office' started by Parminder Singh, May 18, 2017.

  1. Parminder Singh

    Parminder Singh

    Joined:
    May 18, 2017
    Likes Received:
    0
    Hello Guys,

    I am looking for a solution where if i have two fields "Material" and "Machining Number" are already available in table "Sliding" show me that assembly number (field) attached a pic of form for reference.

    any help will great!


    Private Sub Machine_drawing_Number_AfterUpdate()
    Dim MachNum As String
    Dim Mat As String
    Dim stLinkCriteria1 As String
    Dim stLinkCriteria2 As String
    Dim Result As String


    MachNum = Me.Machine_drawing_Number.Value
    Mat = Me.Combo222.Value
    Result = Me.Assembly_Drawing_Number.Value

    stLinkCriteria1 = "[Machine_drawing_Number]= " & "'" & MachNum & "'"
    stLinkCriteria2 = "[Combo222]= " & "'" & Mat & "'"

    If Me.Machine_drawing_Number = DLookup("[Assembly Drawing Number]", "SlidingStem_Table", stLinkCriteria1 And stLinkCriteria2) Then
    MsgBox "This Machine Drawing No#, " & Result & ", has already been entered in database." _
    & vbCr & vbCr & "Please check the Machine no# again.", vbInformation, "Duplicate information."

    Me.Undo
    End If

    End Sub
     

    Attached Files:

    Parminder Singh, May 18, 2017
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. cryptokid

    Word Microsoft Word 2000 SR-1

    cryptokid, Sep 29, 2007, in forum: Microsoft Office
    Replies:
    0
    Views:
    435
    cryptokid
    Sep 29, 2007
  2. bfree

    Outlook Outlook Print 1 page

    bfree, Sep 30, 2008, in forum: Microsoft Office
    Replies:
    2
    Views:
    723
    bfree
    Sep 30, 2008
  3. superchicken1961

    Outlook outlook sending 1 of 62 messages when only 1 message sent

    superchicken1961, Jul 31, 2009, in forum: Microsoft Office
    Replies:
    0
    Views:
    695
    superchicken1961
    Jul 31, 2009
  4. DanielG

    Word 1 added by Word 2007 at the end of a checkbox's name

    DanielG, Jan 17, 2010, in forum: Microsoft Office
    Replies:
    0
    Views:
    1,229
    DanielG
    Jan 17, 2010
  5. Buckingham

    Word Word 2007 manual duplex - tray 1 only

    Buckingham, Apr 4, 2011, in forum: Microsoft Office
    Replies:
    5
    Views:
    1,733
    Silverhazesurfer
    Apr 5, 2011
  6. nmp
    Replies:
    1
    Views:
    759
  7. AccessDeb

    Access Access 2010 - Date()-1 and times in query

    AccessDeb, Sep 1, 2014, in forum: Microsoft Office
    Replies:
    0
    Views:
    737
    AccessDeb
    Sep 1, 2014
  8. Stephanie Dillon

    Excel 1 vs 10 in Excel Formula

    Stephanie Dillon, Mar 5, 2015, in forum: Microsoft Office
    Replies:
    0
    Views:
    466
    Stephanie Dillon
    Mar 5, 2015
Loading...