473,382 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

MSAccess to OpenOffficeOrg.base

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

Jan 17 '07 #1
2 1475
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
<ne*******@swva.netwrote in message
news:11*********************@l53g2000cwa.googlegro ups.com...
>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

Jan 18 '07 #2
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/ex...ributors2.html for contact
info.
<ne*******@swva.netwrote in message
news:11*********************@l53g2000cwa.googlegro ups.com...
>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

Jan 18 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: (Pete Cresswell) | last post by:
I've got a .BAT file that I use for executing various MS Access apps that I wrote way back in the days of 2.0. It's evolved over time, but it still contains a number of possible paths to...
1
by: pw | last post by:
Someone was using our A97 product earlier in the day. He exited it, and now can't open the application. He is all of a sudden getting "MSAccess.exe has encountered an error and needs to close". ...
4
by: Annick Van Hoof | last post by:
Hi, I'm having my ASP.NET application hosted at a Windows 2003 server (IIS6). This works almost all the time (I have uptimes of 100% on most days), but then all of a sudden a few days in a row I...
0
by: MLH | last post by:
I've been unable to determine the correct setting to force a copy of msaccess.exe to be written to target disk during runtime installation process. It may be that the runtime installation...
0
by: nitintiwari | last post by:
can some one help me with the above topic i want a code in vb6 to convert an excel file to be converted to msaccess file and copy the same file to my data base file
2
by: reidarT | last post by:
I am making an installation program for an Access application. The application is run on both Office 2000, 2002, 2003 and soon 2007 versions of Office, When I install the application I need a...
1
by: rolandsk | last post by:
I need help to schedule a MsAccess procedure I want the procedure to run in backgrund and not the MsAccess file to be open during the time when the procedure runs. The procedure in MsAccess picks...
0
Kermit
by: Kermit | last post by:
Hi. I looked through few pages of threads here, but didn't find the answer to my questions. I'm writting a C# application (Windows Forms) that uses MSAccess database, and I have the following...
0
by: bbrewder | last post by:
I am struggling with some MSAccess automation issues. Basically, we have a .Net application that uses MSAccess for reporting (legacy code). We are able to launch MSAccess fine and even work with...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.