Access 16.0 Object Library do i need it (1 Viewer)

MIkeD666

Registered User.
Local time
Today, 07:50
Joined
Jan 12, 2019
Messages
59
Hello all, I need a little help. I have a project in office 365, accesss vba. I want to use/add a Office. FileDialog box. but I need to add in a copy of Office 16.0 object libary object. but i can not find a copy of it on line. any one got any ideas...
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:50
Joined
May 7, 2009
Messages
19,248
look for Microsoft Office 16.0 Object Library

the other Library:
Microsoft Office 16.0 Access database engine Object Library, is for DAO (acedao) object.
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 07:50
Joined
Oct 29, 2018
Messages
21,478
Can you use late binding?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 09:50
Joined
Feb 28, 2001
Messages
27,195
Actually, if you use the FileSystemObject, you can get a file picker box, but for that you use the Scripting library.



The 2nd example shows it in Excel, but both Excel and Access use VBA so it works either way.
 

MIkeD666

Registered User.
Local time
Today, 07:50
Joined
Jan 12, 2019
Messages
59
Hi sorry for not replying soon, been a bit busy on other things. i solved the issue shorty after i posted the post.
thank you all. i have another issue that am posting shorty that i need help with.
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:50
Joined
Sep 21, 2011
Messages
14,322
Hi sorry for not replying soon, been a bit busy on other things. i solved the issue shorty after i posted the post.
thank you all. i have another issue that am posting shorty that i need help with.
It would be nice to say how you solved it. Might help someone else in the future.?
After all that is what these forums are for, to share knowledge.?
 

MIkeD666

Registered User.
Local time
Today, 07:50
Joined
Jan 12, 2019
Messages
59
I found I had that i had not selected the item Microsoft office 16.0 object in the reference window. my brain was not working well as normal
 

MIkeD666

Registered User.
Local time
Today, 07:50
Joined
Jan 12, 2019
Messages
59
SO the lesson was don't assume, it makes a ass of me..
 

MIkeD666

Registered User.
Local time
Today, 07:50
Joined
Jan 12, 2019
Messages
59
I have made a form, for users to input new items to be added to the database.

On the screen the is 6 image objects, each with a unique name such as image1 to 6.

I use a fileDialog window for the user to pick which image individually to be assigned to the relevant image object. AS the will be a few hundred thousand images, used a number of different times and methods when it goes live. I store the address of the image in the table and not the image it self. The images are all located in the same dir / folder

My problem is it works fine on the first 2 instances assigning the address ok to a text edit box and displaying the image fine in the image object. So the user can confirm he picked the right image. But it fall’s over on the third attempt to assign a new image address, when a image is selected for the filedialog window. And gives this error message “ AN error number:2220 =Microsoft can’t open the file ‘ c:/wamp64/live images/mee.jpg”
and crashes
thanks u all once again
miked666

new record window.png


Code:
Code below
'open file dialog box to open a file
'Private Sub fileNamePicked_Click()

Function fileNamePicked_Click() As String



On Error GoTo subError
'Add " Microsoft office 14.0 object library " in referances  and
 'visual basic for app
  'M/c Access 16.0 object libary
  'OLE AUTO
  ' M/C office 16.0 database eng
  'mc office 16.0 object labary
  'm/c script runtime

Dim imagename As String
Dim FDialog As Office.FileDialog
Dim Varfile As Variant ' the varfile is the name fo files shown in the fdialog box

 imagename = "" ' clears the  date if any in the variable
txtSelectedName = "" ' clears the  data if any in the variable

  ' set up the file Dialog
  Set FDialog = Application.FileDialog(msoFileDialogFilePicker)
 
  With FDialog
  .InitialFileName = ""
   .Title = " Pick the photo file you want to import but you can only pick gif or jpg files types"
   .AllowMultiSelect = False ' note for images set this to false
   .InitialFileName = "C:\wamp64\www\LandMweb\images\ " 'Folder picker needs trailing slash, this will leave the file name at the bottom blank
  
   .Filters.Clear
   .Filters.Add " gif image files", "*.Gif"
   .Filters.Add " Jpg image files", "*.JPG*"
  
   'below are extra file filtters you may wish to use
   '.Filters.Add " Excel files", "*.xls*"
   '.Filters.Add " Excel files", "*.xlsx*"
   '.Filters.Add " Excel files, macro enabled", "*.xlsm*"
  
   If .show = True Then ' the user picked open, if is false userpick cancal
         If .SelectedItems.Count = 0 Then
           MsgBox "You did not pick a file", , , vbCritical + vbOKOnly, _
             "an error has occrred"
             GoTo SubExit
        End If
      
       'the for loop below is used only when mulit select is true
       For Each Varfile In .SelectedItems
        txtSelectedName = txtSelectedName & Varfile & vbCrLf '(vbcrlf is for a carrage return to start a new line)
         imagename = txtSelectedName
      
            
       Next
   Else
     'user cancelled dialog without choosing
    
   End If
End With

fileNamePicked_Click = txtSelectedName
Me.Image77.Picture = txtSelectedName 'Me.imageADD1
Me.Refresh
SubExit:
 On Error Resume Next
  Set FDialog = Nothing
 Exit Function
subError:
 MsgBox " an Error number:" & Err.Number & " = " & Err.Description, vbCritical + vbOKOnly, _
 "AN error occurrred, i think because i picked execl only "
 
  GoTo SubExit
 
 
End Function
 

MIkeD666

Registered User.
Local time
Today, 07:50
Joined
Jan 12, 2019
Messages
59
Hi all i have solved this issue above.. i had for some unknown reason add the line
Code:
Me.Image79.Picture = txtSelectedName 'Me.imageADD1

Near the bottom of the function, which caused the problem as it should have not been there
 

Users who are viewing this thread

Top Bottom