Help!!!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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>
 
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
 
Excellent...that's a different and less complicated approach.

Any suggestions how do I do that? (have never used the Dir/kill commands)

Bill said:
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
 
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




Belinda said:
Excellent...that's a different and less complicated approach.

Any suggestions how do I do that? (have never used the Dir/kill commands)
 
Thanks! Off to try it. Thank you Bill :)

Bill said:
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
 
Back
Top