Results 1 to 4 of 4
  1. #1
    dweekley is offline Advanced Beginner
    Windows XP Access 2002 (version 10.0)
    Join Date
    May 2010
    Posts
    52

    Button to open pdf, VBA

    I have a button that onclick would open a pdf file. I am getting a 'data type mismatch in criteria expression' messege.

    I have checked and every thing, and all is short text in the table. I can see in debug that the cmbCUSTIDABBR has the correct value from the form.

    'Open Customer Drawing


    'Dwg. field empty
    If Len(Me.txtDWG.Value & "") > 0 Then

    Dim FL As String 'File Location
    Dim FN As String 'File Name
    Dim FLFN As String 'File Location \ File Name

    FL = DLookup("[Dwg_File_Loc]", "t_Customer", "[CustomerID] = " & [Forms]![f_Estimate]![cmbCUSTIDABBR])
    FN = txtDWG.Value
    FLFN = FL & "" & FN & ".pdf"

    txtFL = FLFN

    Application.FollowHyperlink FLFN

    Else

    MsgBox "Drawing filename field is empty" _
    & Chr$(13) _


    & "Enter drawing filename to continue with opening drawing", vbOKOnly, "No Filename"

    End If

    What am I missing.

    TIA

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    In the DLookup? See if this helps:

    DLookup Usage Samples
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    dweekley is offline Advanced Beginner
    Windows XP Access 2002 (version 10.0)
    Join Date
    May 2010
    Posts
    52
    Sweet. All's good. One of these days I'll get the formatting down.

    Thank you much.

    David

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    No problem David.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 3
    Last Post: 10-20-2014, 03:25 PM
  2. Replies: 1
    Last Post: 05-31-2013, 08:53 AM
  3. Button to open certain tab
    By LukeJ Innov in forum Forms
    Replies: 2
    Last Post: 05-10-2013, 07:07 AM
  4. Button to open a Report
    By 95DSM in forum Reports
    Replies: 1
    Last Post: 07-09-2010, 11:11 AM
  5. Open a second db from a cmd button
    By Rick West in forum Access
    Replies: 3
    Last Post: 05-12-2010, 08:44 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