9
NTPCUG Microsoft Access SIG Oct. 15, 2011 Moving Data In and Out of Microsoft Access A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson, Oct. 15, 2011 . pyright 2001, 2011 by L.M. Linson, all rights reser

NTPCUG Microsoft Access SIG Oct. 15, 2011 Moving Data In and Out of Microsoft Access A Presentation for the Microsoft Access SIG of the North Texas PC

Embed Size (px)

Citation preview

Page 1: NTPCUG Microsoft Access SIG Oct. 15, 2011 Moving Data In and Out of Microsoft Access A Presentation for the Microsoft Access SIG of the North Texas PC

NTPCUG Microsoft Access SIG Oct. 15, 2011

Moving Data In and Out of Microsoft Access

A Presentation for the Microsoft Access SIG of the North Texas PC User Group

by Larry Linson, Oct. 15, 2011 .

© Copyright 2001, 2011 by L.M. Linson, all rights reserved

Page 2: NTPCUG Microsoft Access SIG Oct. 15, 2011 Moving Data In and Out of Microsoft Access A Presentation for the Microsoft Access SIG of the North Texas PC

NTPCUG Microsoft Access SIG Oct. 15, 2011

Today’s Agenda Storing external files (can be ‘unknown

format’) in BLOBs Recreating the external file from a BLOB What topics do you want to cover in future

meetings?

Page 3: NTPCUG Microsoft Access SIG Oct. 15, 2011 Moving Data In and Out of Microsoft Access A Presentation for the Microsoft Access SIG of the North Texas PC

NTPCUG Microsoft Access SIG Oct. 15, 2011

Storing External Files in Access DB, and recreating them later

Note: Works with files of any type or format

Page 4: NTPCUG Microsoft Access SIG Oct. 15, 2011 Moving Data In and Out of Microsoft Access A Presentation for the Microsoft Access SIG of the North Texas PC

NTPCUG Microsoft Access SIG Oct. 15, 2011

Image File as Example “Moving Data” Database

– frmImageBlobDataEntry to acquire image» Uses Common Dialog to Obtain File

» Displays Picture

» User clicks button to validate selection

» Executes Procedure “ReadBLOB” In Module “basBLOB” Step through file, using “AppendChunk” to store into the

OLE Object type field of record

Page 5: NTPCUG Microsoft Access SIG Oct. 15, 2011 Moving Data In and Out of Microsoft Access A Presentation for the Microsoft Access SIG of the North Texas PC

NTPCUG Microsoft Access SIG Oct. 15, 2011

Image File as Example, cont.

“Moving Data” Database– frmImageBlobSummaryList to show image

» Double Click invokes “OpenDetailForm” In Form’s Module to open frmImageBLOBDetail

– Open event recreates an image file using

– “WriteBLOB” procedure to re-create file

– Sets re-created file as Picture property

– Of Image Control to Display

Page 6: NTPCUG Microsoft Access SIG Oct. 15, 2011 Moving Data In and Out of Microsoft Access A Presentation for the Microsoft Access SIG of the North Texas PC

NTPCUG Microsoft Access SIG Oct. 15, 2011

Image File as Example, cont.

“WriteBLOB” Procedure– From the OLE Object containing BLOB

» Calculates Number of Blocks and leftover blocks

» Generates Temporary File Name Obtain data from BLOB and Writes the external file

Page 7: NTPCUG Microsoft Access SIG Oct. 15, 2011 Moving Data In and Out of Microsoft Access A Presentation for the Microsoft Access SIG of the North Texas PC

NTPCUG Microsoft Access SIG Oct. 15, 2011

What did he say? External File can be stored in DB

– Store as Binary Large Object (BLOB)– File type is immaterial

» Image file used as example» Could be any file type

– AppendChunk and GetChunk ops » Handle ‘pieces’ of data» Construct and extract from OLE Object field

Could also use Memo field

Page 8: NTPCUG Microsoft Access SIG Oct. 15, 2011 Moving Data In and Out of Microsoft Access A Presentation for the Microsoft Access SIG of the North Texas PC

NTPCUG Microsoft Access SIG Oct. 15, 2011

What topics do you want? Recent has been “developer level”, VBA

code Earlier we reviewed “basics” What should be next

– Access 2010? General, incl. “classic”?– Basic – end-user features?– Advanded – developer features?

Page 9: NTPCUG Microsoft Access SIG Oct. 15, 2011 Moving Data In and Out of Microsoft Access A Presentation for the Microsoft Access SIG of the North Texas PC

NTPCUG Microsoft Access SIG Oct. 15, 2011

Thank you

for your kind attention Please come again And, please . . .

– Gently wake your neighbor before leaving