Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2007

Tip: Looking for answers? Try searching our database.

Code from 2003 no longer works on 2007

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
chase washington - 14 Mar 2007 17:22 GMT
I barely know enough about Microsoft Access to get by and I created a program
for work that keeps track of inventory and uses a visual basic code to pull
up pictures in forms. This has always worked great on Access 2003 but since
we upgraded to 2007 this no longer works. If anyone could please tell me what
I need to do to this code to get it to work in 2007 I would greatly
appreciate it.

Option Compare Database

Private Sub Form_Current()
On Error GoTo err_Form_Current

If Not Me!txtPicture = "" Or Not IsNull(Me!txtPicture) Then
Me!Picture.Picture = GetPathPart & Me!txtPicture
Else
Me!Picture.Picture = ""
End If

If Not Me!txtPicture2 = "" Or Not IsNull(Me!txtPicture2) Then
Me!Picture2.Picture = GetPathPart & Me!txtPicture2
Else
Me!Picture2.Picture = ""
End If

If Not Me!txtPicture3 = "" Or Not IsNull(Me!txtPicture3) Then
Me!Picture3.Picture = GetPathPart & Me!txtPicture3
Else
Me!Picture3.Picture = ""
End If

exit_Form_Current:
Exit Sub

err_Form_Current:
MsgBox Err.Description
Resume exit_Form_Current
End Sub

Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open

If IsNull(Me!txtPicture) Or Me!txtPicture = "" Then
' do nothing
Else
Me!Picture.Picture = GetPathPart & Me!txtPicture
End If

If IsNull(Me!txtPicture2) Or Me!txtPicture2 = "" Then
' do nothing
Else
Me!Picture2.Picture = GetPathPart & Me!txtPicture2
End If

If IsNull(Me!txtPicture3) Or Me!txtPicture3 = "" Then
' do nothing
Else
Me!Picture3.Picture = GetPathPart & Me!txtPicture3
End If

Exit_Form_Open:
Exit Sub

Err_Form_Open:
MsgBox Err.Description
Resume Exit_Form_Open

End Sub
Allen Browne - 14 Mar 2007 17:31 GMT
In Access 2007, go to:
   Office Button | Access Options | Trust Center | Trusted Locations

Add the folder where you keep your databases to the trusted locations.

If the code is for Image controls, you may be interested to know that the
Image Control in A2007 now has a Control Source. You can just set the
Control Source to an expression such as:
   = GetPathPart & Me!txtPicture
and it works without code.

More info about the new version:
   http://allenbrowne.com/Access2007.html

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I barely know enough about Microsoft Access to get by and I created a
>program
[quoted text clipped - 67 lines]
>
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.