I need some desperate help.
BACKGROUND
I have some users that can't grasp the concept they need to download (from a
mainframe) a report before the go clicking buttons in an Access database.
This results in old data getting processed back into the report. An
exception query shows the discrepancies but I have to personally go in and
delete the older records whenever they do this. I have rigged Monarch
(DataWatch's software to process mainframe report into table format) via a
calculated field and a filter to export only those fields with the current
date (so, wrong date, report exports a blank row).
Request
I know how to do the MsgBox in Access that will tell them "YOU IDIOT!!
Download the report FIRST." What I need is Access to look at the report it
imports (Monarch's resulting table) and if it's blank, row count=0, file size
=1kb, whatever, that it will then pop up a message box. If report OK, then
it will proceed as usual.
Warnings
I'm an Access idiot, please don't give me anything too complicated...
CODE
Private Sub cmdImportFiles_Click()
Dim stAppName As String
'Launch Monarch and process today's report
stAppName = "H:\IMPORT\IMPSAS\APEX\Macros\PCSOL.bat"
Call ShellWait(stAppName, 1)
DoCmd.Hourglass True
DoCmd.SetWarnings False
'Import today's report into Access
DoCmd.TransferDatabase acImport, "dBase 5.0",
"H:\IMPORT\IMPSAS\APEX\MFiles\", acTable, "STARFAX.DBF", "starfax"
<INSERT FILE CHECK HERE>
-----------
Thanks!!
Bill - 29 Jun 2005 16:37 GMT
Hi Belinda,
Will it suffice to delete the downloaded file after you've
imported its contents into the Access table, then each
time your user seeks to run the report you can look for the
existance of the downloaded file? That is, you always demand
the existance of the downloaded file before you run the report.
If so, then use the Kill command to delete the file after you've
imported it and use the Dir command to detect its presence.
This approach assumes it's not unacceptable to download
every time the report is run AND that there's no harm done to
the Access table if the import is re-run somewhat redundantly.
Hope this helps.
Bill
>I need some desperate help.
>
[quoted text clipped - 38 lines]
>
> Thanks!!
Belinda - 29 Jun 2005 17:03 GMT
Excellent...that's a different and less complicated approach.
Any suggestions how do I do that? (have never used the Dir/kill commands)
> Hi Belinda,
> Will it suffice to delete the downloaded file after you've
[quoted text clipped - 54 lines]
> >
> > Thanks!!
Bill - 30 Jun 2005 02:56 GMT
Hi Belinda!
Sorry for the delay, I was gone all day.
Here are a couple of code segments that use both the
Kill and Dir commands.
================================================
Private Sub ZipOnlyCmd_Click()
If Me.Check76 + Me.Check78 + Me.Check79 + Me.Check80 + Me.Check81 = 0 Then
msgbox "No files selected"
Else
Me.Refresh
If Dir(Me.DistZIPName) <> "" Then Kill Me.DistZIPName 'Delete the
file before we prepare contents of a new one.
Call SendADFData(False)
End If
End Sub
================================================
Note that in this example that Me.DistZIPName is a character string
containing the fully qualified name and path of the file of interest. The
code simply deletes it if it already exists.
Bill
> Excellent...that's a different and less complicated approach.
>
[quoted text clipped - 65 lines]
>> >
>> > Thanks!!
Belinda - 05 Jul 2005 16:09 GMT
Thanks! Off to try it. Thank you Bill :)
> Hi Belinda!
> Sorry for the delay, I was gone all day.
[quoted text clipped - 93 lines]
> >> >
> >> > Thanks!!