help access 97 to 2k

X

x

I've got the following instuctions for a form in access 97 , can anyone help
me write it so that it will run on access 2k
ACC: How to Load OLE Objects from a Folder into a Table
Applies To
This article was previously published under Q158941
Moderate: Requires basic macro, coding, and interoperability skills.


SUMMARY
This article shows you how to automatically append all files with a
particular extension from a specified folder on the hard disk into a table.
This routine is good for loading OLE objects, such as .gif, .jpg, .doc,
..xls, or .bmp files that are associated with an OLE Server, into a Microsoft
Access database.

This article assumes that you are familiar with Visual Basic for
Applications and with creating Microsoft Access applications using the
programming tools provided with Microsoft Access. For more information about
Visual Basic for Applications, please refer to your version of the "Building
Applications with Microsoft Access" manual.

NOTE: To associate a graphic file with an OLE Server, open it with an OLE
Server package such as Microsoft Imager or Microsoft Paint, and save the
file.

For information about working programmatically with an OLE object in a form
in Microsoft Access version 2.0, please see the following article in the
Microsoft Knowledge Base:
114214 ACC2: How to Programmatically Embed or Link an Object in a Form

MORE INFORMATION
Method to Import OLE Object Files
1.. Create the following new table in Design view. Save it as tblLoadOLE:
Table: tblLoadOLE
------------------------
Field Name: OLEID
Data Type: AutoNumber
Field Name: OLEPath
Data Type: Text
Field Size: 255
Field Name: OLEFile
Data Type: OLE Object

Table Properties: tblLoadOLE
----------------------------
PrimaryKey: OLEID
2.. Using the AutoForm: Columnar Wizard, create a new form based on the
tblLoadOLE table. Save it as frmLoadOLE.
3.. Open the frmLoadOLE form in Design view.
4.. Create three unbound text box controls in the form header section of
the form:
Form: frmLoadOLE
------------------------
Text Box:
Name: SearchFolder
Text Box:
Name: SearchExtension
Text Box:
Name: OLEClass
5.. Create a command button on the form:
Command Button
--------------
Name: cmdLoadOLE
Caption: Load Files
6.. Type the following event procedure in the OnClick property of the
cmdLoadOLE button:
Private Sub cmdLoadOLE_Click()

Dim MyFolder As String
Dim MyExt As String
Dim MyPath As String
Dim MyFile As String
Dim strCriteria As String

MyFolder = Me!SearchFolder
' Get the search path.
MyPath = MyFolder & "\" & "*." & [SearchExtension]
' Get the first file in the path containing the file extension.
MyFile = Dir(MyPath, vbNormal)
Do While Len(MyFile) <> 0
[OLEPath] = MyFolder & "\" & MyFile
[OLEFile].Class = [OLEClass]
[OLEFile].OLETypeAllowed = acOLEEmbedded
[OLEFile].SourceDoc = [OLEPath]
[OLEFile].Action = acOLECreateEmbed
' Check for next OLE file in the folder.
MyFile = Dir
' Go to new record on form.
' For Access 95 only, use the following Line of code:
DoCmd.DoMenuItem acFormBar, acEditMenu, 12, 4, acMenuVer70

' For Access 97 only, use the following line of code:
'DoCmd.RunCommand acCmdRecordsGoToNew
Loop

End Sub
7.. Save the frmLoadOLE form and open it in Form view.
8.. Type the full path name of the folder you want to search in the
SearchFolder text box.
9.. Type the file extension you want to load in the SearchExtension text
box, such as bmp, jpg, doc, xls, tif, or gif. Do not type a period as part
of the extension.
10.. Type the Class name for the type of file you are loading, such as
Paint.Picture for .bmp files.

NOTE: To determine the Class name of an OLE object, see the documentation
for the application supplying the object.
11.. Click the Load Files button. Note that All files that match the
SearchFolder and SearchExtension you entered are added to the tblLoadOLE
table.
doing my head in as I'm pretty new to this, steep learning curve I know..
many thanks in antisapation

regards

Iain
 
T

TC

These forums work best if you ask a single, specific question.

What is your specific question?

TC


x said:
I've got the following instuctions for a form in access 97 , can anyone help
me write it so that it will run on access 2k
ACC: How to Load OLE Objects from a Folder into a Table
Applies To
This article was previously published under Q158941
Moderate: Requires basic macro, coding, and interoperability skills.


SUMMARY
This article shows you how to automatically append all files with a
particular extension from a specified folder on the hard disk into a table.
This routine is good for loading OLE objects, such as .gif, .jpg, .doc,
.xls, or .bmp files that are associated with an OLE Server, into a Microsoft
Access database.

This article assumes that you are familiar with Visual Basic for
Applications and with creating Microsoft Access applications using the
programming tools provided with Microsoft Access. For more information about
Visual Basic for Applications, please refer to your version of the "Building
Applications with Microsoft Access" manual.

NOTE: To associate a graphic file with an OLE Server, open it with an OLE
Server package such as Microsoft Imager or Microsoft Paint, and save the
file.

For information about working programmatically with an OLE object in a form
in Microsoft Access version 2.0, please see the following article in the
Microsoft Knowledge Base:
114214 ACC2: How to Programmatically Embed or Link an Object in a Form

MORE INFORMATION
Method to Import OLE Object Files
1.. Create the following new table in Design view. Save it as tblLoadOLE:
Table: tblLoadOLE
------------------------
Field Name: OLEID
Data Type: AutoNumber
Field Name: OLEPath
Data Type: Text
Field Size: 255
Field Name: OLEFile
Data Type: OLE Object

Table Properties: tblLoadOLE
----------------------------
PrimaryKey: OLEID
2.. Using the AutoForm: Columnar Wizard, create a new form based on the
tblLoadOLE table. Save it as frmLoadOLE.
3.. Open the frmLoadOLE form in Design view.
4.. Create three unbound text box controls in the form header section of
the form:
Form: frmLoadOLE
------------------------
Text Box:
Name: SearchFolder
Text Box:
Name: SearchExtension
Text Box:
Name: OLEClass
5.. Create a command button on the form:
Command Button
--------------
Name: cmdLoadOLE
Caption: Load Files
6.. Type the following event procedure in the OnClick property of the
cmdLoadOLE button:
Private Sub cmdLoadOLE_Click()

Dim MyFolder As String
Dim MyExt As String
Dim MyPath As String
Dim MyFile As String
Dim strCriteria As String

MyFolder = Me!SearchFolder
' Get the search path.
MyPath = MyFolder & "\" & "*." & [SearchExtension]
' Get the first file in the path containing the file extension.
MyFile = Dir(MyPath, vbNormal)
Do While Len(MyFile) <> 0
[OLEPath] = MyFolder & "\" & MyFile
[OLEFile].Class = [OLEClass]
[OLEFile].OLETypeAllowed = acOLEEmbedded
[OLEFile].SourceDoc = [OLEPath]
[OLEFile].Action = acOLECreateEmbed
' Check for next OLE file in the folder.
MyFile = Dir
' Go to new record on form.
' For Access 95 only, use the following Line of code:
DoCmd.DoMenuItem acFormBar, acEditMenu, 12, 4, acMenuVer70

' For Access 97 only, use the following line of code:
'DoCmd.RunCommand acCmdRecordsGoToNew
Loop

End Sub
7.. Save the frmLoadOLE form and open it in Form view.
8.. Type the full path name of the folder you want to search in the
SearchFolder text box.
9.. Type the file extension you want to load in the SearchExtension text
box, such as bmp, jpg, doc, xls, tif, or gif. Do not type a period as part
of the extension.
10.. Type the Class name for the type of file you are loading, such as
Paint.Picture for .bmp files.

NOTE: To determine the Class name of an OLE object, see the documentation
for the application supplying the object.
11.. Click the Load Files button. Note that All files that match the
SearchFolder and SearchExtension you entered are added to the tblLoadOLE
table.
doing my head in as I'm pretty new to this, steep learning curve I know..
many thanks in antisapation

regards

Iain
 
X

x

Where to start. I have several 1000 jpg on a server I want ot create a form
to retrieve these but only with the number of the file I enter, Say get
320069.jpg 351200.jpg etc....
I kind of know it a thousand questions but I m swamped by the info online. A
clue or related site to point me in the direction I wish to go, thanks for
your time in reading this
Cheers

Iain

TC said:
These forums work best if you ask a single, specific question.

What is your specific question?

TC


x said:
I've got the following instuctions for a form in access 97 , can anyone help
me write it so that it will run on access 2k
ACC: How to Load OLE Objects from a Folder into a Table
Applies To
This article was previously published under Q158941
Moderate: Requires basic macro, coding, and interoperability skills.


SUMMARY
This article shows you how to automatically append all files with a
particular extension from a specified folder on the hard disk into a table.
This routine is good for loading OLE objects, such as .gif, .jpg, .doc,
.xls, or .bmp files that are associated with an OLE Server, into a Microsoft
Access database.

This article assumes that you are familiar with Visual Basic for
Applications and with creating Microsoft Access applications using the
programming tools provided with Microsoft Access. For more information about
Visual Basic for Applications, please refer to your version of the "Building
Applications with Microsoft Access" manual.

NOTE: To associate a graphic file with an OLE Server, open it with an OLE
Server package such as Microsoft Imager or Microsoft Paint, and save the
file.

For information about working programmatically with an OLE object in a form
in Microsoft Access version 2.0, please see the following article in the
Microsoft Knowledge Base:
114214 ACC2: How to Programmatically Embed or Link an Object in a Form

MORE INFORMATION
Method to Import OLE Object Files
1.. Create the following new table in Design view. Save it as tblLoadOLE:
Table: tblLoadOLE
------------------------
Field Name: OLEID
Data Type: AutoNumber
Field Name: OLEPath
Data Type: Text
Field Size: 255
Field Name: OLEFile
Data Type: OLE Object

Table Properties: tblLoadOLE
----------------------------
PrimaryKey: OLEID
2.. Using the AutoForm: Columnar Wizard, create a new form based on the
tblLoadOLE table. Save it as frmLoadOLE.
3.. Open the frmLoadOLE form in Design view.
4.. Create three unbound text box controls in the form header section of
the form:
Form: frmLoadOLE
------------------------
Text Box:
Name: SearchFolder
Text Box:
Name: SearchExtension
Text Box:
Name: OLEClass
5.. Create a command button on the form:
Command Button
--------------
Name: cmdLoadOLE
Caption: Load Files
6.. Type the following event procedure in the OnClick property of the
cmdLoadOLE button:
Private Sub cmdLoadOLE_Click()

Dim MyFolder As String
Dim MyExt As String
Dim MyPath As String
Dim MyFile As String
Dim strCriteria As String

MyFolder = Me!SearchFolder
' Get the search path.
MyPath = MyFolder & "\" & "*." & [SearchExtension]
' Get the first file in the path containing the file extension.
MyFile = Dir(MyPath, vbNormal)
Do While Len(MyFile) <> 0
[OLEPath] = MyFolder & "\" & MyFile
[OLEFile].Class = [OLEClass]
[OLEFile].OLETypeAllowed = acOLEEmbedded
[OLEFile].SourceDoc = [OLEPath]
[OLEFile].Action = acOLECreateEmbed
' Check for next OLE file in the folder.
MyFile = Dir
' Go to new record on form.
' For Access 95 only, use the following Line of code:
DoCmd.DoMenuItem acFormBar, acEditMenu, 12, 4, acMenuVer70

' For Access 97 only, use the following line of code:
'DoCmd.RunCommand acCmdRecordsGoToNew
Loop

End Sub
7.. Save the frmLoadOLE form and open it in Form view.
8.. Type the full path name of the folder you want to search in the
SearchFolder text box.
9.. Type the file extension you want to load in the SearchExtension text
box, such as bmp, jpg, doc, xls, tif, or gif. Do not type a period as part
of the extension.
10.. Type the Class name for the type of file you are loading, such as
Paint.Picture for .bmp files.

NOTE: To determine the Class name of an OLE object, see the documentation
for the application supplying the object.
11.. Click the Load Files button. Note that All files that match the
SearchFolder and SearchExtension you entered are added to the tblLoadOLE
table.
doing my head in as I'm pretty new to this, steep learning curve I know..
many thanks in antisapation

regards

Iain
 
T

test

Create a form with a textbox named txtNumber. Put the following code into
the BeforeUpdate event of the textbox:

dim s as string
s = "C:/Blah/" & me![txtNumber] & ".jpg"
if dir$(s) = "" then
msgbox "No file: " & s
else
msgbox "File " & s & " exists"
endif

Now run the form and enter 320069 (for example) into the textbox. The form
will try to locate file C:/Blah/320069.jpg, and tell you whether that file
exists or not. You could easily modify the code to look for the files in a
different directory (of your choice). Then you could expand the code to
"retrieve" the specified jpg (whatever you mean by "retrieve").

Does that help?

TC


x said:
Where to start. I have several 1000 jpg on a server I want ot create a form
to retrieve these but only with the number of the file I enter, Say get
320069.jpg 351200.jpg etc....
I kind of know it a thousand questions but I m swamped by the info online. A
clue or related site to point me in the direction I wish to go, thanks for
your time in reading this
Cheers

Iain

These forums work best if you ask a single, specific question.

What is your specific question?

TC


anyone
help
section
of
the form:
Form: frmLoadOLE
------------------------
Text Box:
Name: SearchFolder
Text Box:
Name: SearchExtension
Text Box:
Name: OLEClass
5.. Create a command button on the form:
Command Button
--------------
Name: cmdLoadOLE
Caption: Load Files
6.. Type the following event procedure in the OnClick property of the
cmdLoadOLE button:
Private Sub cmdLoadOLE_Click()

Dim MyFolder As String
Dim MyExt As String
Dim MyPath As String
Dim MyFile As String
Dim strCriteria As String

MyFolder = Me!SearchFolder
' Get the search path.
MyPath = MyFolder & "\" & "*." & [SearchExtension]
' Get the first file in the path containing the file extension.
MyFile = Dir(MyPath, vbNormal)
Do While Len(MyFile) <> 0
[OLEPath] = MyFolder & "\" & MyFile
[OLEFile].Class = [OLEClass]
[OLEFile].OLETypeAllowed = acOLEEmbedded
[OLEFile].SourceDoc = [OLEPath]
[OLEFile].Action = acOLECreateEmbed
' Check for next OLE file in the folder.
MyFile = Dir
' Go to new record on form.
' For Access 95 only, use the following Line of code:
DoCmd.DoMenuItem acFormBar, acEditMenu, 12, 4, acMenuVer70

' For Access 97 only, use the following line of code:
'DoCmd.RunCommand acCmdRecordsGoToNew
Loop

End Sub
7.. Save the frmLoadOLE form and open it in Form view.
8.. Type the full path name of the folder you want to search in the
SearchFolder text box.
9.. Type the file extension you want to load in the SearchExtension text
box, such as bmp, jpg, doc, xls, tif, or gif. Do not type a period as part
of the extension.
10.. Type the Class name for the type of file you are loading, such as
Paint.Picture for .bmp files.

NOTE: To determine the Class name of an OLE object, see the documentation
for the application supplying the object.
11.. Click the Load Files button. Note that All files that match the
SearchFolder and SearchExtension you entered are added to the tblLoadOLE
table.
doing my head in as I'm pretty new to this, steep learning curve I know..
many thanks in antisapation

regards

Iain
 
X

x

its a starting point cheers
Have a nice day

test said:
Create a form with a textbox named txtNumber. Put the following code into
the BeforeUpdate event of the textbox:

dim s as string
s = "C:/Blah/" & me![txtNumber] & ".jpg"
if dir$(s) = "" then
msgbox "No file: " & s
else
msgbox "File " & s & " exists"
endif

Now run the form and enter 320069 (for example) into the textbox. The form
will try to locate file C:/Blah/320069.jpg, and tell you whether that file
exists or not. You could easily modify the code to look for the files in a
different directory (of your choice). Then you could expand the code to
"retrieve" the specified jpg (whatever you mean by "retrieve").

Does that help?

TC


x said:
Where to start. I have several 1000 jpg on a server I want ot create a form
to retrieve these but only with the number of the file I enter, Say get
320069.jpg 351200.jpg etc....
I kind of know it a thousand questions but I m swamped by the info
online.
A
clue or related site to point me in the direction I wish to go, thanks for
your time in reading this
Cheers

Iain

These forums work best if you ask a single, specific question.

What is your specific question?

TC


I've got the following instuctions for a form in access 97 , can anyone
help
me write it so that it will run on access 2k
ACC: How to Load OLE Objects from a Folder into a Table
Applies To
This article was previously published under Q158941
Moderate: Requires basic macro, coding, and interoperability skills.


SUMMARY
This article shows you how to automatically append all files with a
particular extension from a specified folder on the hard disk into a
table.
This routine is good for loading OLE objects, such as .gif, .jpg, .doc,
.xls, or .bmp files that are associated with an OLE Server, into a
Microsoft
Access database.

This article assumes that you are familiar with Visual Basic for
Applications and with creating Microsoft Access applications using the
programming tools provided with Microsoft Access. For more information
about
Visual Basic for Applications, please refer to your version of the
"Building
Applications with Microsoft Access" manual.

NOTE: To associate a graphic file with an OLE Server, open it with
an
OLE
Server package such as Microsoft Imager or Microsoft Paint, and save the
file.

For information about working programmatically with an OLE object in a
form
in Microsoft Access version 2.0, please see the following article in the
Microsoft Knowledge Base:
114214 ACC2: How to Programmatically Embed or Link an Object in a Form

MORE INFORMATION
Method to Import OLE Object Files
1.. Create the following new table in Design view. Save it as
tblLoadOLE:
Table: tblLoadOLE
------------------------
Field Name: OLEID
Data Type: AutoNumber
Field Name: OLEPath
Data Type: Text
Field Size: 255
Field Name: OLEFile
Data Type: OLE Object

Table Properties: tblLoadOLE
----------------------------
PrimaryKey: OLEID
2.. Using the AutoForm: Columnar Wizard, create a new form based on the
tblLoadOLE table. Save it as frmLoadOLE.
3.. Open the frmLoadOLE form in Design view.
4.. Create three unbound text box controls in the form header
section
of
the form:
Form: frmLoadOLE
------------------------
Text Box:
Name: SearchFolder
Text Box:
Name: SearchExtension
Text Box:
Name: OLEClass
5.. Create a command button on the form:
Command Button
--------------
Name: cmdLoadOLE
Caption: Load Files
6.. Type the following event procedure in the OnClick property of the
cmdLoadOLE button:
Private Sub cmdLoadOLE_Click()

Dim MyFolder As String
Dim MyExt As String
Dim MyPath As String
Dim MyFile As String
Dim strCriteria As String

MyFolder = Me!SearchFolder
' Get the search path.
MyPath = MyFolder & "\" & "*." & [SearchExtension]
' Get the first file in the path containing the file extension.
MyFile = Dir(MyPath, vbNormal)
Do While Len(MyFile) <> 0
[OLEPath] = MyFolder & "\" & MyFile
[OLEFile].Class = [OLEClass]
[OLEFile].OLETypeAllowed = acOLEEmbedded
[OLEFile].SourceDoc = [OLEPath]
[OLEFile].Action = acOLECreateEmbed
' Check for next OLE file in the folder.
MyFile = Dir
' Go to new record on form.
' For Access 95 only, use the following Line of code:
DoCmd.DoMenuItem acFormBar, acEditMenu, 12, 4, acMenuVer70

' For Access 97 only, use the following line of code:
'DoCmd.RunCommand acCmdRecordsGoToNew
Loop

End Sub
7.. Save the frmLoadOLE form and open it in Form view.
8.. Type the full path name of the folder you want to search in the
SearchFolder text box.
9.. Type the file extension you want to load in the
SearchExtension
text
box, such as bmp, jpg, doc, xls, tif, or gif. Do not type a period
as
part
of the extension.
10.. Type the Class name for the type of file you are loading,
such
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top