Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 509
  • Last Modified:

Copy "Long binary Data"

I have a database where i store images (OLE OBJECT) and the field inside the table has the value "Long Binary Data".
I am trying to copy everything to another database and i would like to copy the field which stores the images as Long Binary Data.
Is there a way to do this ?

Thanks in advance
0
viroz
Asked:
viroz
  • 3
  • 2
2 Solutions
 
tbsgadiCommented:
Hi viroz,

A regular copy or append query should work

Gary
0
 
virozAuthor Commented:
No right click "Copy" available.
0
 
tbsgadiCommented:
If you're copying straight from the table then select the whole column (Copy is available)
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
virozAuthor Commented:
Ijust want to copy seperate fields. Is there a way to do this ?
0
 
tbsgadiCommented:
Filter (on the ID) for the record you want & then select the column
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
You looking to do this manually or via code?  If code, then you want to use GetChunk() and AppendChunk().  I've attached a sample of code from the on-line help.

JimD.
Sub AppendChunkX()
 
	Dim dbsNorthwind As Database
	Dim rstEmployees As Recordset
	Dim rstEmployees2 As Recordset
 
	Set dbsNorthwind = OpenDatabase("Northwind.mdb")
 
	' Open two recordsets from the Employees table.
	Set rstEmployees = _
		dbsNorthwind.OpenRecordset("Employees", _
		dbOpenDynaset)
	Set rstEmployees2 = rstEmployees.Clone
 
	' Add a new record to the first Recordset and copy the 
	' data from a record in the second Recordset.
	With rstEmployees
 
.AddNew
		!FirstName = rstEmployees2!FirstName
		!LastName = rstEmployees2!LastName
		CopyLargeField rstEmployees2!Photo, !Photo
		.Update
 
		' Delete new record because this is a demonstration.
		.Bookmark = .LastModified
		.Delete
		.Close
	End With
 
	rstEmployees2.Close
	dbsNorthwind.Close
 
End Sub
 
Function CopyLargeField(fldSource As Field, _
	fldDestination As Field)
 
	' Set size of chunk in bytes.
	Const conChunkSize = 32768
 
Dim lngOffset As Long
	Dim lngTotalSize As Long
	Dim strChunk As String
 
	' Copy the photo from one Recordset to the other in 32K 
	' chunks until the entire field is copied.
	lngTotalSize = fldSource.FieldSize
	Do While lngOffset < lngTotalSize
		strChunk = fldSource.GetChunk(lngOffset, conChunkSize)
		fldDestination.AppendChunk strChunk
		lngOffset = lngOffset + conChunkSize
	Loop
 
End Function

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now