473,396 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Path File Access 75 error on Open strHTMLFile for Output As

http://bytes.com/topic/access/answer...html-file-code

Using the resource above as a template, I am having an issue I cannot identify.

I would appreciate any assistance by a quick audit of this code to determine why I am getting an error on Line 20:

Open strHTMLFile For Output As #1

Access 2007 ACCDB VBA Module

The purpose of this would be to cycle thru multiple records in a table and return an html file for each present.



VBA:
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database 
  2.  
  3. Private Sub sCreateStaticHTMLFiles_Click() 
  4.     Dim Db As DAO.Database 
  5.     Dim rs As DAO.Recordset 
  6.     Dim strHTMLFile As String 
  7.     Dim s As String 
  8.     Set Db = CurrentDb 
  9.  
  10.  
  11.     Set rs = Db.OpenRecordset("SELECT * FROM XTab ORDER BY ID") 
  12.     If rs.EOF Then 
  13.         MsgBox "Empty Table" 
  14.  
  15.         s = Trim(rs!ID) 
  16.  
  17.         strHTMLFile = "E:\RMS\XTAB\" & Format(s, "000") & ".htm" 
  18.     End If 
  19.     s = Trim(rs!ID) 
  20.     Open strHTMLFile For Output As #1 
  21.     Print #1, "<html><head></head><body><TABLE BORDER=1>" 
  22.     Print #1, "<TR bgcolor=E0E0E0 align=center><TD>Specialty</TD><TD>Business Unit</TD><TD>Cost Center</TD><TD>LOC_NAME</TD><TD>Status</TD><TD>Billing ID</TD><TD>Client_Name</TD><TD>ops_level_1</TD><TD>ops_level_2</TD><TD>ops_level_3</TD><TD>ops_level_4</TD><TD>ops_primary</TD><TD>client_level_4</TD><TD>client_primary</TD><TD>Total Of Balance</TD><TD>121 - 150</TD><TD>150+</TD><TD>61 - 90</TD><TD>91 - 120</TD></TR>" 
  23.  
  24.     If StrComp(s, Trim(rs!ID), vbTextCompare) <> 0 Then 'New file
  25.         If diff Then 
  26.             Print #1, "</TABLE></body></html>" 
  27.             Close #1 
  28.             Open strHTMLFile For Output As #1 
  29.             Print #1, "<html><head></head><body><TABLE BORDER=1>" 
  30.             Print #1, "<TR bgcolor=E0E0E0 align=center><TD>Specialty</TD><TD>Business Unit</TD><TD>Cost Center</TD><TD>LOC_NAME</TD><TD>Status</TD><TD>Billing ID</TD><TD>Client_Name</TD><TD>ops_level_1</TD><TD>ops_level_2</TD><TD>ops_level_3</TD><TD>ops_level_4</TD><TD>ops_primary</TD><TD>client_level_4</TD><TD>client_primary</TD><TD>Total Of Balance</TD><TD>121 - 150</TD><TD>150+</TD><TD>61 - 90</TD><TD>91 - 120</TD></TR>" 
  31.             Print #1, "<TR><TD>" & rs!Specialty & "</TD><TD>" & rs!Business; Unit & "</TD><TD>" & rs!Cost; Center & "</TD><TD>" & rs!LOC_NAME & "</TD><TD>" & rs!Status & "</TD><TD>" & rs!Billing; ID & "</TD><TD>" & rs!Client_Name & "</TD><TD>" & rs!ops_level_1 & "</TD><TD>" & rs!ops_level_2 & "</TD><TD>" & rs!ops_level_3 & "</TD><TD>" & rs!ops_level_4 & "</TD><TD>" & rs!ops_primary & "</TD><TD>" & rs!client_level_4 & "</TD><TD>" & rs!client_primary & "</TD><TD>" & rs!Total; Of; Balance & "</TD><TD>" & rs![121 - 150] & "</TD><TD>" & rs![150+] & "</TD><TD>" & rs![61 - 90] & "</TD><TD>" & rs![91 - 120] & "</TD></TR>" 
  32.  
  33.  
  34.             rs.MoveNext 
  35.             Do 
  36.             Loop Until rs.EOF 
  37.             Print #1, "</TABLE></body></html>" 
  38.             Close #1 
  39.         End If 
  40.     End If 
  41. End Sub 
Aug 8 '11 #1
3 2516
NeoPa
32,556 Expert Mod 16PB
Line #20 references strHTMLFile, but this is only ever set if rs.EOF is True.
Aug 8 '11 #2
OK, so I need to change rs.EOF to BOF or add BOF also?

What other issues might I encounter?

Thank you very much!
Aug 8 '11 #3
NeoPa
32,556 Expert Mod 16PB
Mi:
OK, so I need to change rs.EOF to BOF or add BOF also?
No. That's not at all what I was saying. You need to ensure that strHTMLFile is set before using it to refer to a file if you want the reference to work.
Mi:
What other issues might I encounter?
No idea. If you want someone to review your code for you then you're in the wrong place (Check out the rules here). We answer specific questions where asked (We help and give guidance to allow you to do your job). We are not an unpaid coding service.
Aug 8 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: MFA | last post by:
Hi All I have one COM (.dll) for uploading files to server. Its working fine on server A but same code and file not working on server B giving error Path/File access error Can any one advise...
1
by: serge calderara | last post by:
dear all, I have problem accessing section group in my configuration application file. I got an error saying thta I can have only one section ???? here is my application configuration looks...
1
by: John Rajendran | last post by:
Hi there, I am trying to use the XMLWriter for writing back the XML data into an XML file which is in the same folder as ASPX file. I am having problems when I write a Dataset from ASPX page to the...
1
by: Paul T. RONG | last post by:
I got this error 75 when I want to exit access. And it just happened on one computer which has been installed windows xp pro english service pack 1, I use A2K runtime. Anybody had met that before?...
1
by: Jim Heavey | last post by:
I have a .Net Console Application. I installed it on a server. I created a bat file on the server which passes the appropriate parms to the program to run. This application accesses and updates...
1
by: Jim Heavey | last post by:
I have a .Net Console Application. I installed it on a server. I created a bat file on the server which passes the appropriate parms to the program to run. This application accesses and updates...
2
by: John Carnahan | last post by:
Using .net in aspx page with following code, and get a write error on the website, but everything works fine on the development machine. ----- code ---- Dim counter As String = CType(logcount,...
1
by: LP | last post by:
If you can't seem to eliminate throwing this exception, then the answer is to look for a different file opened previously with an invalid or missing filename. For example, assume the following...
2
by: klaash | last post by:
I created a program using VB6 which has many dependency JPG files. All files are installed in the same subfolder folder of Program Files folder using Package and Deployment Wizard. in VB6....
3
kZero
by: kZero | last post by:
Hi, i have problem with this code in windows vista intfile = FreeFile Open strDestination For Binary Access Write As #intfile Run-time error '75': Path/File access error
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.