illegal Operation reading txt file str ? 
Author Message
 illegal Operation reading txt file str ?

I never get these things right without help from this Wonderful ng:

DoCmd.OutputTo acOutputQuery, "NotifyEdDwg", acFormatTXT,
"C:\E_Mail\Ed_DWG.txt"

Dim strE As String

Open "C:\E_Mail\Ed_DWG.txt" For Binary Access Read Lock Read As #1

Do While Not EOF(1)
    strE = strE & Input(1, #1)
Loop
Close #1


strE

Sometimes above works, but after e mail is sent or closed Access does
illegal operation and will be shutdown...

Frequently I get the illegal operation........... before the e mail opens.

What am I doing wrong?

Paul



Sat, 24 Apr 2004 22:10:03 GMT  
 illegal Operation reading txt file str ?
Paul,

I wonder if C:\E_Mail\Ed_DWG.txt is fully written to the disk by the time you want to open it.

To test, I would write the file then comment out the DoCmd.OutputTo... and try the rest of your code.  If all works reliably, I would think about some delays or an error trapping routine to open the file in Append mode and trap for the write conflict if Access is not done outputting.

Steve

Quote:

> I never get these things right without help from this Wonderful ng:

> DoCmd.OutputTo acOutputQuery, "NotifyEdDwg", acFormatTXT,
> "C:\E_Mail\Ed_DWG.txt"

> Dim strE As String

> Open "C:\E_Mail\Ed_DWG.txt" For Binary Access Read Lock Read As #1

> Do While Not EOF(1)
>     strE = strE & Input(1, #1)
> Loop
> Close #1


> strE

> Sometimes above works, but after e mail is sent or closed Access does
> illegal operation and will be shutdown...

> Frequently I get the illegal operation........... before the e mail opens.

> What am I doing wrong?

> Paul



Sun, 25 Apr 2004 01:14:31 GMT  
 illegal Operation reading txt file str ?
The only questions I have is, Why are you reading the file you just exported
out of your database? Couldn't you read the query on you database and then
just use that on your email?
Unless you actually need a file (for your own reasons), I would just read
the data on the query and then put that on my email.
And I agree, most of the time the reason you get the errors, is because the
hardrive hasn't finished writting the file. You migh be able to put a do
events on your code, but I doubt that'll do anyting to the errors.

You can use dao to read the data on your query, and put int on a string
(then use that string from your email). Just search for openrecordset on the
help menu.

Rodrigo.


Quote:
> I never get these things right without help from this Wonderful ng:

> DoCmd.OutputTo acOutputQuery, "NotifyEdDwg", acFormatTXT,
> "C:\E_Mail\Ed_DWG.txt"

> Dim strE As String

> Open "C:\E_Mail\Ed_DWG.txt" For Binary Access Read Lock Read As #1

> Do While Not EOF(1)
>     strE = strE & Input(1, #1)
> Loop
> Close #1


> strE

> Sometimes above works, but after e mail is sent or closed Access does
> illegal operation and will be shutdown...

> Frequently I get the illegal operation........... before the e mail opens.

> What am I doing wrong?

> Paul



Sun, 25 Apr 2004 01:36:48 GMT  
 illegal Operation reading txt file str ?
Steve,

If I do as u say I still get the illegal operation....
If I comment out the DoCmd.SendObject acSendNoObject, , , then I never get
the illegal operation...

Paul
Paul,

I wonder if C:\E_Mail\Ed_DWG.txt is fully written to the disk by the time
you want to open it.

To test, I would write the file then comment out the DoCmd.OutputTo... and
try the rest of your code.  If all works reliably, I would think about some
delays or an error trapping routine to open the file in Append mode and trap
for the write conflict if Access is not done outputting.

Steve


Quote:
> I never get these things right without help from this Wonderful ng:

> DoCmd.OutputTo acOutputQuery, "NotifyEdDwg", acFormatTXT,
> "C:\E_Mail\Ed_DWG.txt"

> Dim strE As String

> Open "C:\E_Mail\Ed_DWG.txt" For Binary Access Read Lock Read As #1

> Do While Not EOF(1)
>     strE = strE & Input(1, #1)
> Loop
> Close #1


> strE

> Sometimes above works, but after e mail is sent or closed Access does
> illegal operation and will be shutdown...

> Frequently I get the illegal operation........... before the e mail opens.

> What am I doing wrong?

> Paul



Sun, 25 Apr 2004 01:39:36 GMT  
 illegal Operation reading txt file str ?
Next let's try to see if there is a limit to the length of text you can send with SendObject.  Try a MsgBox Len(strE) after you have read the file to count the characters.  Use Notepad to chop off some of the file and see if there is a limit to SendObject.

Steve

Quote:

> Steve,

> If I do as u say I still get the illegal operation....
> If I comment out the DoCmd.SendObject acSendNoObject, , , then I never get
> the illegal operation...

> Paul

> Paul,

> I wonder if C:\E_Mail\Ed_DWG.txt is fully written to the disk by the time
> you want to open it.

> To test, I would write the file then comment out the DoCmd.OutputTo... and
> try the rest of your code.  If all works reliably, I would think about some
> delays or an error trapping routine to open the file in Append mode and trap
> for the write conflict if Access is not done outputting.

> Steve



> > I never get these things right without help from this Wonderful ng:

> > DoCmd.OutputTo acOutputQuery, "NotifyEdDwg", acFormatTXT,
> > "C:\E_Mail\Ed_DWG.txt"

> > Dim strE As String

> > Open "C:\E_Mail\Ed_DWG.txt" For Binary Access Read Lock Read As #1

> > Do While Not EOF(1)
> >     strE = strE & Input(1, #1)
> > Loop
> > Close #1


> > strE

> > Sometimes above works, but after e mail is sent or closed Access does
> > illegal operation and will be shutdown...

> > Frequently I get the illegal operation........... before the e mail opens.

> > What am I doing wrong?

> > Paul



Sun, 25 Apr 2004 01:51:06 GMT  
 illegal Operation reading txt file str ?
U got it Steve !

apx. 86 characters is ok, apx.210 characters is ok, apx 1100 characters
causes Access to illegal operation...

Of course when/if e mail opens and I click send, Access still does the
illegal operation....   after sending the e mail.

hmmmm, if I replace TXT with HTML, RTF, or XLS then the e mail message is
unintelligible, but I can close the e mail or send it without Access doing
illegal operation.

Maybe there is a better way to do what I need to do. This is, send multiply
records (Query record set) directly in e mail body.

Paul

Next let's try to see if there is a limit to the length of text you can send
with SendObject.  Try a MsgBox Len(strE) after you have read the file to
count the characters.  Use Notepad to chop off some of the file and see if
there is a limit to SendObject.

Steve


Quote:
> Steve,

> If I do as u say I still get the illegal operation....
> If I comment out the DoCmd.SendObject acSendNoObject, , , then I never get
> the illegal operation...

> Paul

> Paul,

> I wonder if C:\E_Mail\Ed_DWG.txt is fully written to the disk by the time
> you want to open it.

> To test, I would write the file then comment out the DoCmd.OutputTo... and
> try the rest of your code.  If all works reliably, I would think about
some
> delays or an error trapping routine to open the file in Append mode and
trap
> for the write conflict if Access is not done outputting.

> Steve



> > I never get these things right without help from this Wonderful ng:

> > DoCmd.OutputTo acOutputQuery, "NotifyEdDwg", acFormatTXT,
> > "C:\E_Mail\Ed_DWG.txt"

> > Dim strE As String

> > Open "C:\E_Mail\Ed_DWG.txt" For Binary Access Read Lock Read As #1

> > Do While Not EOF(1)
> >     strE = strE & Input(1, #1)
> > Loop
> > Close #1


> > strE

> > Sometimes above works, but after e mail is sent or closed Access does
> > illegal operation and will be shutdown...

> > Frequently I get the illegal operation........... before the e mail
opens.

> > What am I doing wrong?

> > Paul



Sun, 25 Apr 2004 02:30:48 GMT  
 illegal Operation reading txt file str ?
Rodrigo,

I'll look into that method. It sounds more like what I need.

tx,
Paul


Quote:
> The only questions I have is, Why are you reading the file you just
exported
> out of your database? Couldn't you read the query on you database and then
> just use that on your email?
> Unless you actually need a file (for your own reasons), I would just read
> the data on the query and then put that on my email.
> And I agree, most of the time the reason you get the errors, is because
the
> hardrive hasn't finished writting the file. You migh be able to put a do
> events on your code, but I doubt that'll do anyting to the errors.

> You can use dao to read the data on your query, and put int on a string
> (then use that string from your email). Just search for openrecordset on
the
> help menu.

> Rodrigo.



> > I never get these things right without help from this Wonderful ng:

> > DoCmd.OutputTo acOutputQuery, "NotifyEdDwg", acFormatTXT,
> > "C:\E_Mail\Ed_DWG.txt"

> > Dim strE As String

> > Open "C:\E_Mail\Ed_DWG.txt" For Binary Access Read Lock Read As #1

> > Do While Not EOF(1)
> >     strE = strE & Input(1, #1)
> > Loop
> > Close #1


> > strE

> > Sometimes above works, but after e mail is sent or closed Access does
> > illegal operation and will be shutdown...

> > Frequently I get the illegal operation........... before the e mail
opens.

> > What am I doing wrong?

> > Paul



Sun, 25 Apr 2004 02:39:33 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. My vb5 .exe file generates an illegal operation

2. Illegal operation in EXE file

3. Excel Automation (illegal operation)

4. Illegal Operation

5. Global MenuBar causes illegal operation in Runtime

6. Illegal Operation - Access Will Shut Down (why?)

7. Illegal operation after running Excel macro

8. Excel 97 illegal operation

9. Windows illegal operation

10. OrganizerCopy Method causing illegal operation stop

11. Cancel button gets Illegal operation error--Word 97

12. IE illegal operation after installation of Vb Package

 

 
Powered by phpBB® Forum Software