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 / General 1 / January 2007

Tip: Looking for answers? Try searching our database.

MSAccess to OpenOffficeOrg.base

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
newvision@swva.net - 17 Jan 2007 17:22 GMT
I am trying to add three photos per record on a form.  I want the path
to each photo stored in a table, each field in the table is labeld
Phot1, Photo2 and Photo 3 respectively. I then want to view each phot
in the form. The name of the Form is Doll2. Can someone please look
this over for accuracy and if it will work in OOoBase?
Thanks

REM  *****  BASIC  *****
Function setImagePath1()
   Dim strImagePath1 As String
   On Error GoTo PictureNotAvailable
   strImagePath1 = Forms!Doll2.Photo1
   Forms!Doll2.Photo1.Locked = True
   Forms!Doll2.Photo1.Enabled = False
   Forms.Doll2.ImageFrame1.Picture = strImagePath1
   Exit Function
PictureNotAvailable:
   strImagePath1 = "C:\NoImage.gif"
   Forms.Doll2.ImageFrame1.Picture = strImagePath1
End Function

Function setImagePath2()
   Dim strImagePath2 As String
   On Error GoTo PictureNotAvailable
   strImagePath2 = Forms!Doll2.Photo2
   Forms!Doll2.Photo2.Locked = True
   Forms!Doll2.Photo2.Enabled = False
   Forms.Doll2.ImageFrame2.Picture = strImagePath2
   Exit Function
PictureNotAvailable:
   strImagePath2 = "C:\NoImage.gif"
   Forms.Doll2.ImageFrame2.Picture = strImagePath2
End Function

Function setImagePath3()
   Dim strImagePath3 As String
   On Error GoTo PictureNotAvailable
   strImagePath3 = Forms!Doll2.Photo3
   Forms!Doll2.Photo3.Locked = True
   Forms!Doll2.Photo3.Enabled = False
   Forms.Doll2.ImageFrame3.Picture = strImagePath3
   Exit Function
PictureNotAvailable:
   strImagePath3 = "C:\NoImage.gif"
   Forms.Doll2.ImageFrame3.Picture = strImagePath3
End Function

Sub Main

cmdAddImage1_Click()
   On Error GoTo cmdAddImage1_Err
   Dim strFilter As String
   Dim lngflags As Long
   Dim varFileName As Variant

   strFilter = "All Files (*.*)" & vbNullChar & "*.*" & vbNullChar &
"All Files (*.*)" & vbNullChar & "*.*"

   lngflags = tscFNPathMustExist Or tscFNFileMustExist Or
tscFNHideReadOnly

   varFileName = tsGetFileFromUser( _
               fOpenFile:=True, _
               strFilter:=strFilter, _
               rlngflags:=lngflags, _
               strDialogTitle:="Please choose a file...")

    If IsNull(varFileName) Then
    Else
        Forms.Doll2.Photo1 = varFileName
        Forms.[Doll2].Form.Requery
    End If

cmdAddImage1_End
   On Error GoTo 0

cmdAddImage1_Err
    On Error GoTo 0

cmdDeleteImage1_Click()
   Forms!Doll2Photo1.Enabled = True
   Forms!Doll2Photo1.SetFocus
   Forms!Doll2Photo1.Locked = False
   Forms!Doll2Photo1.Text = ""
   Forms!Doll2Photo1.SetFocus
   Forms.[Doll2].Form.Requery
   Forms!Doll2Photo1.Locked = True
   Forms!Doll2Photo1.Enabled = False
Exit Sub

Photo1_AfterUpdate()
   setImagePath1
   Forms.[Doll2].Form.Requery
Exit Sub

cmdAddImage2_Click()
   On Error GoTo cmdAddImage2_Err

   varFileName = tsGetFileFromUser( _
               fOpenFile:=True, _
               strFilter:=strFilter, _
               rlngflags:=lngflags, _
               strDialogTitle:="Please choose a file...")

    If IsNull(varFileName) Then
    Else
        Forms!Doll2.Photo2 = varFileName
        Forms.[Doll2].Form.Requery
    End If

cmdAddImage2_End
   On Error GoTo 0
   Exit Sub

cmdAddImage2_Err
   On Error GoTo 0
   Exit Sub

cmdDeleteImage2_Click()
   Forms!Doll2.Photo2.Enabled = True
   Forms!Doll2.Photo2.SetFocus
   Forms!Doll2Photo2.Locked = False
   Forms!Doll2Photo2.Text = ""
   Forms!Doll2Photo2.SetFocus
   Forms.[Doll2].Form.Requery
   Forms!Doll2.Photo2.Locked = True
   Forms!Doll2.Photo2.Enabled = False
Exit Sub

   Photo2_AfterUpdate()
   setImagePath2
   Forms.[Doll2].Form.Requery
Exit Sub

cmdAddImage3_Click()
   On Error GoTo cmdAddImage3_Err

   varFileName = tsGetFileFromUser( _
               fOpenFile:=True, _
               strFilter:=strFilter, _
               rlngflags:=lngflags, _
               strDialogTitle:="Please choose a file...")

    If IsNull(varFileName) Then
    Else
        Forms!Doll2.Photo3 = varFileName
        Forms.[Doll2].Form.Requery
    End If

cmdAddImage3_End
   On Error GoTo 0
   Exit Sub

cmdAddImage3_Err
   On Error GoTo 0
   Exit Sub

cmdDeleteImage3_Click()
   Forms!Doll2.Photo3.Enabled = True
   Forms!Doll2.Photo3.SetFocus
   Forms!Doll2.Photo3.Locked = False
   Forms!Doll2.Photo3.Text = ""
   Forms!Doll2.Photo3.SetFocus
   Forms.[Doll2].Form.Requery
   Forms!Doll2.Photo3.Locked = True
   Forms!Doll2.Photo3.Enabled = False
Exit Sub

Photo3_AfterUpdate()
   setImagePath3
   Forms.[Doll2].Form.Requery
Exit Sub

End Sub
Larry Linson - 18 Jan 2007 02:15 GMT
The subject of this newsgroup is Microsoft Access. You will have a better
chance of getting your question answered in a newsgroup where the subject is
the software you are asking about. I am reasonably sure that a very small
subset of posters here use both Access and OpenOffice.

I would be more than a bit surprised if Access VBA could be directly used,
unaltered, in any OpenOffice software. And, generally, it is unusual to get
thoughtful answers to posts with that much code, in any newsgroup. For good
suggestions on effective use of this newsgroup, see the FAQ at
http://www.mvps.org/access/netiquette.htm.

 Larry Linson
 Microsoft Access MVP

>I am trying to add three photos per record on a form.  I want the path
> to each photo stored in a table, each field in the table is labeld
[quoted text clipped - 170 lines]
>
> End Sub
'69 Camaro - 18 Jan 2007 04:29 GMT
Hi.

> Can someone please look
> this over for accuracy

It's not accurate.  Accurate compared to what?  Accurate compared to "code
that will work."  Your code won't work in Access.

> and if it will work in OOoBase?

No.  It won't work in that database, either.

My recommendation is to abandon this attempt and start over.  Create one
procedure to set the image path, one procedure to add the image, and one
procedure to delete the image, not three procedures for each functionality.
For each of these procedures, make it general enough so that all you have to
do is pass either the control object or the name of the control to the
procedure, and the code inside the procedure will take care of it no matter
which control is being operated on.

If you need help with the code for Open Office Base, please post your
question in an Open Office Base newsgroup or forum, such as the one on the
following Web page:

http://www.oooforum.org/forum/viewforum.phtml?f=10

This newsgroup is dedicated to Microsoft Access databases, so one cannot
expect much assistance for issues with other software products.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog:  http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.

>I am trying to add three photos per record on a form.  I want the path
> to each photo stored in a table, each field in the table is labeld
[quoted text clipped - 170 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.