Re: Pack a linked DB file
From: Maureen (nosend2me_at_hotmail.com)
Date: 05/05/04
- Next message: anonymous_at_discussions.microsoft.com: "Emailing Files"
- Previous message: ray: "Get External Data menu unavailable"
- In reply to: Joe Fallon: "Re: Pack a linked DB file"
- Next in thread: Joe Fallon: "Re: Pack a linked DB file"
- Reply: Joe Fallon: "Re: Pack a linked DB file"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 5 May 2004 11:04:45 -0400
Thanks Joe - I'll give it a go!
M
"Joe Fallon" <jfallon1@nospamtwcny.rr.com> wrote in message
news:uyl9EYlMEHA.1484@tk2msftngp13.phx.gbl...
> Yes.
> That is a much clearer picture!
>
> Ok here is a way to do it using an old utility program I found on the web.
> It looks like a lot of code but just copy/paste where you are supposed to
> and it should work.
> =================================================================
>
> Code for ShellWait came from here:
> http://www.mvps.org/access/api/api0004.htm
>
> =================================================================
> Step1:
> Create a new Module named Module1 and paste all this code into it and save
> it.
>
> Option Compare Database
> Option Explicit
>
> '***************** Code Start ******************
> 'This code was originally written by Terry Kreft.
> 'It is not to be altered or distributed,
> 'except as part of an application.
> 'You are free to use it in any application,
> 'provided the copyright notice is left unchanged.
> '
> 'Code Courtesy of
> 'Terry Kreft
> Private Const STARTF_USESHOWWINDOW& = &H1
> Private Const NORMAL_PRIORITY_CLASS = &H20&
> Private Const INFINITE = -1&
>
> Private Type STARTUPINFO
> cb As Long
> lpReserved As String
> lpDesktop As String
> lpTitle As String
> dwX As Long
> dwY As Long
> dwXSize As Long
> dwYSize As Long
> dwXCountChars As Long
> dwYCountChars As Long
> dwFillAttribute As Long
> dwFlags As Long
> wShowWindow As Integer
> cbReserved2 As Integer
> lpReserved2 As Long
> hStdInput As Long
> hStdOutput As Long
> hStdError As Long
> End Type
>
> Private Type PROCESS_INFORMATION
> hProcess As Long
> hThread As Long
> dwProcessID As Long
> dwThreadID As Long
> End Type
>
> Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
> hHandle As Long, ByVal dwMilliseconds As Long) As Long
>
> Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
> lpApplicationName As Long, ByVal lpCommandLine As String, ByVal _
> lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
> ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
> ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, _
> lpStartupInfo As STARTUPINFO, lpProcessInformation As _
> PROCESS_INFORMATION) As Long
>
> Private Declare Function CloseHandle Lib "kernel32" (ByVal _
> hObject As Long) As Long
>
> Public Sub ShellWait(Pathname As String, Optional WindowStyle As Long)
> Dim proc As PROCESS_INFORMATION
> Dim start As STARTUPINFO
> Dim ret As Long
> ' Initialize the STARTUPINFO structure:
> With start
> .cb = Len(start)
> If Not IsMissing(WindowStyle) Then
> .dwFlags = STARTF_USESHOWWINDOW
> .wShowWindow = WindowStyle
> End If
> End With
> ' Start the shelled application:
> ret& = CreateProcessA(0&, Pathname, 0&, 0&, 1&, _
> NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
> ' Wait for the shelled application to finish:
> ret& = WaitForSingleObject(proc.hProcess, INFINITE)
> ret& = CloseHandle(proc.hProcess)
> End Sub
> '***************** Code End ****************
>
> ================================================================
> Step 2:
> On one of your forms add a button named btnRun and put this code behind
it:
> (modify the path to where you store your dBaseIII files. This command may
> pack ALL of them in that folder so you may need to change the * to the
real
> file name if you only want one packed.
>
> Private Sub btnRun_Click()
> On Error GoTo Err_btnRun_Click
>
> Dim stAppName As String
>
> stAppName = "C:\MyDbaseFiles\pack3.exe *.dbf"
> Call ShellWait(stAppName, 1)
>
> Exit_btnRun_Click:
> Exit Sub
>
> Err_btnRun_Click:
> MsgBox Err.Description
> Resume Exit_btnRun_Click
>
> End Sub
>
> ================================================================
> Step3:
> Detach the utility file named Pack3.zip and extract it. It is a single
file
> named Pack3.exe.
> Place Pack3.exe in the same folder as above - where the dBase file is
> stored.
> ================================================================
>
> Step 4: run your form and click the button - it should run the Pack3.exe
and
> pack all .dbf files in the folder.
>
> ================================================================
>
> Step5: let me know if it works!
> ================================================================
> --
> Joe Fallon
> Access MVP
>
>
>
> "Maureen" <nosend2me@hotmail.com> wrote in message
> news:evqWkYYMEHA.1900@TK2MSFTNGP10.phx.gbl...
> > Joe,
> >
> > From access a delete query clears thre DB file of the previous job and
> then
> > an append query adds the next one. After this is done we have to open
the
> DB
> > program and pack the records before printing the labels to avoid blank
> ones.
> > This is done 20 or 30 times a day and I'd like to automate the whole
> > proceedure.
> >
> > If (from access) I create a new DB file the label program can not
connect
> to
> > it. I have tried DBIII, IV & V with no luck. I created the lable DB
using
> > the DB editior in the lable program and use access to stuff in what I
> need.
> > I would like to either 1) pack from access 2) find some way to call the
> pack
> > from the DB editor with no intervention 3) find a way to create a new
file
> > each time that the lable program can connect to.
> >
> > Not sure if this will help shed light??? I have submitted a help request
> to
> > lableview as well.
> >
> > M
> >
> > "Joe Fallon" <jfallon1@nospamtwcny.rr.com> wrote in message
> > news:uVKl%23hWMEHA.2456@TK2MSFTNGP12.phx.gbl...
> > > Maureen,
> > > I am a bit confused - how does the dBase file get created?
> > > If Access creates it then just don't include deleted records.
> > >
> > > If Access does not create it, then what does?
> > > Doesn't that program have a Pack command in it?
> > >
> > >
> > > BTW - I don't know how to Pack from Access.
> > > You may be able to Shell out to a Program that does know how to Pack.
> > > Not sure what that gains you.
> > > --
> > > Joe Fallon
> > > Access MVP
> > >
> > >
> > >
> > > "Maureen" <nosend2me@hotmail.com> wrote in message
> > > news:e56ed638.0405030826.46378040@posting.google.com...
> > > > Joe,
> > > >
> > > > Thanks for your post. My issue is not in access - I need to pack the
> > > > DB file for the label printig program since it still sees the
deleted
> > > > records and prints blank labels. Currently we are opening the
finished
> > > > DB in the label program and packing it before we print. I would like
> > > > to eliminate this step by packing the DB as part of the access
routine
> > > > that creates the data. I suspect there may be some little utility
out
> > > > there that I can call from access to do the packing.
> > > >
> > > > M
> > > >
> > > >
> > > >
> > > > "Joe Fallon" <jfallon1@nospamtwcny.rr.com> wrote in message
> > > news:<OcWwg7LMEHA.1156@TK2MSFTNGP09.phx.gbl>...
> > > > > I vaguely recall that there is either a registry setting or an
.ini
> > file
> > > > > setting that hides deleted dBase (and Foxpro) records from Access.
> Try
> > > > > searching MSKB or Google for info on this.
> > > > >
> > > > > Basically, Access should not see deleted records in dBase so you
> > should
> > > only
> > > > > have to pack it whenever you feel like it.
> > > > >
> > > > > --
> > > > > Joe Fallon
> > > > > Access MVP
> > > > >
> > > > >
> > > > >
> > > > > "Maureen" <nosend2me@hotmail.com> wrote in message
> > > > > news:eUeHpVLMEHA.2832@TK2MSFTNGP10.phx.gbl...
> > > > > > Can anyone suggest how I might be able to "pack" a linked DBIII
> file
> > > from
> > > > > > within access. I am using access to build the data needed for a
> > label
> > > > > > printer (it can only read DBIII) and currently have to open the
> > > printer
> > > > > > utility to pack the database to remove the deleted records. I
> would
> > > like
> > > > > to
> > > > > > eliminate this step by including something that can be called
from
> > > access
> > > > > > that will look after this. Any suggestions or direction would
be
> > > > > > apprecitated!
> > > > > >
> > > > > > M
> > > > > >
> > > > > >
> > >
> > >
> >
> >
>
>
>
- Next message: anonymous_at_discussions.microsoft.com: "Emailing Files"
- Previous message: ray: "Get External Data menu unavailable"
- In reply to: Joe Fallon: "Re: Pack a linked DB file"
- Next in thread: Joe Fallon: "Re: Pack a linked DB file"
- Reply: Joe Fallon: "Re: Pack a linked DB file"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|