Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2010
    Posts
    20

    bypass file picker?

    I am using the code below to open the file picker and grab an object. I can then translate the object into Base64 and write it out into an XML file without importing and saving the object. However, in certain cases I already have the path stored in the database and would like to use that path instead of opening the file picker.



    is there a way to substitute the path "c:\files\myPDF.pdf" for "fd.SelectedItems(1)" and grab that object without opening the file picker? My goal is to avoid importing the object into a table, but just grab the object and translate it to Base64 then write it out into an XML file.
    _______________________________________

    Private Sub cmbAddBinaryData_Click()


    FilePickerControl = False
    'Open the File Picker control
    Set fd = Application.FileDialog(msoFileDialogFilePicker)
    fd.AllowMultiSelect = False
    If fd.Show = -1 Then
    txtfiletoupload = fd.SelectedItems(1)
    End If


    Open txtfiletoupload For Binary Access Read As #1

    ReDim ByteImage(1 To LOF(1))
    Get #1, , ByteImage

    Close #1

    strData = EncodeBase64(ByteImage)

    Me.txtAttBinaryDataPath = txtfiletoupload

    FilePickerControl = True

  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,521
    It should be fairly simple. To alternatively use a fixed path:
    Code:
    If SomeTestHere Then
      txtfiletoupload = "c:\files\myPDF.pdf"
    Else
      Your existing code here
    End If
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Join Date
    Jul 2010
    Posts
    20

    only converts the path itself

    thanks Paul....unfortunately that only puts the string itself ("c:\files\myPDF.pdf") into the variable and then only converts the path into the binary data. I need to be able to convert the PDF itself that's at that location into binary.

  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,521
    I thought that's what you wanted:

    is there a way to substitute the path "c:\files\myPDF.pdf" for "fd.SelectedItems(1)"

    Doesn't your existing code just put a path into that variable with this?

    txtfiletoupload = fd.SelectedItems(1)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Join Date
    Jul 2010
    Posts
    20
    Well, that's what I thought too, but the code "txtfiletoupload = fd.SelectedItems(1)" apparently puts the object into the code.

  6. #6
    Join Date
    Jul 2010
    Posts
    20
    you're right Paul!!! I started looking at what else might be causing the error and discovered I had the code "ReDim ByteImage(1 To LOF(1))" in 2 places.....but.....in the 2nd place it was "ReDim ByteImage(1, LOF(1))" (note the comma instead of the "to").

    Many thanks for getting me off of my obsessive focus on the "txtfiletoupload = fd.SelectedItems(1)" !!!

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Ah good, glad it worked. I was rather stumped at what else it could be.
    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. Date Picker?
    By gazzieh in forum Forms
    Replies: 9
    Last Post: 02-09-2013, 09:35 AM
  2. Date Picker doesn't appear
    By revnice in forum Access
    Replies: 9
    Last Post: 01-09-2012, 08:36 AM
  3. Bypass startup to allow design
    By cjbuechler in forum Access
    Replies: 1
    Last Post: 06-25-2010, 03:38 AM
  4. Date picker
    By BI4K12 in forum Access
    Replies: 1
    Last Post: 06-09-2010, 11:11 AM
  5. Time picker for Access 2003
    By Thiyagu in forum Access
    Replies: 1
    Last Post: 03-24-2010, 06:36 AM

Tags for this Thread

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