Module Error question

  • Thread starter Thread starter jray214
  • Start date Start date
J

jray214

Guest
I want to do the following. That the results of the query and output it to a HTML. Now, I need to be able to process the query row by row and test for different information. Based upon the results is what tag I use.

The following code was used to test some basic open and closed, but I get an error.

Thanks for the help

Jim

Here is the code:
Option Compare Database

Dim db As Database
Dim rs As Recordset

Set db = CurrentDb <Errors here>
Set rs = db.OpeRecordset("qryDefault")

Open "myHTML.html" For Output As #1
Print #1, "<html><body>"

Do While Not rs.EOF
Print #1, rs!Project & rs!font_color
Loop

Close #1

Set db = Nothing
Set rs = Nothing

Here is the error:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Compile error. in query expressions 'ApploadString([bw_tblBtnActions].[Description])'.
 
Since the error states 'In query expression' I believe that the error comes from
Set rs = db.OpenRecordset("qryDefault")
rather then from
Set db = Currentdb
Let us see your SQL.

[BTW it should be OpeNrecordset as above, typo?]
Alex

[This message has been edited by Alexandre (edited 03-04-2002).]
 
Thank you for the correction. I made the change and I still get this stuid error,
"Compile error. in query expressions 'ApploadString([bw_tblBtnActions].[Description])'.:

When I run the button macro. Why would the button macro care what I have in a Modual? This is wierd.

I wonder if I am going about this all wrong?

I'll post a new question about this.

Thanks again
 
Here is the query and some sample data: The Query is going to be called like this.

1. Open Form
2. Select project <Combo box>
3. Call query with filter to project <call VBA module>
4. Read each row and write code for each one.

I think that is it. I know it is really hard to visualize what I want to do and I do appreciate the help.

Jim

SELECT [Project], [Menu_Level], [menu_width], [left_position], [top_position], [Title], [Href], [Parm1], [Parm2], [Parm3], [JSWindow]
FROM MenuParms;

Project Menu_Level menu_width left_position top_position Title Href Parm1 Parm2 Parm3 JSWindow
Security 1 300 80 150 The CERT® Coordination Center http://www.cert.org/ 1 0 0 Yes
 
No error that I can see in what you showed me. But you are talking about a filter and I do not see anything like a WHERE clause here.
How do you build your filter, and combin it to your SQL statement? How does this filter look like?

Alex

[This message has been edited by Alexandre (edited 03-10-2002).]
 
Hi there,

Been just having the same error this morning, the error message is once again in matter of Access/Microsoft not showing the real reason ...

so to give you some background, here it is:


Basically, I had restarted my application from scratch, just importing my modules from my previous database - which works fine and didnt show that message when attempting to add a close button on a form - , and I actually merged all functions from my previous modules into one module in the new database, and that's where the problem was, not the References from VBA, or any other crap ...


Here's the piece of my code that was causing the error:

--------------------------START----------------------------
'32-bit API declarations
Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long


Declare Function SHBrowseForFolder Lib "shell32.dll" _
Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long

-------------------------END------------------------------------

Basically, if I put this shell lib declaration at end of the module, then I get the error, if I put it at beginning of my module, no error ...

I suggest you do the same, just put your code bit by bit in another module, and see which piece is causing the problem ...
Once you got it, isolate, and put it in a separate module so you wont be bothered anymore...

And Microsoft : Thanks for your so much helping error message descriptions which really help us debug ...
 
Goerge:
I guess this is a question for me as Jray didnt write since 2002...

Answer is:
it doesn't really matter, I solved the problem for my code, just wanted to give a tip for future readers ...

To answer your question anyway:

im not even runing code on these lib declarations.
just declared them for future use,
but if these declarations are at the end of the code, this shows up same message that Jray had ...
I would suppose that due to the fact we don't have his full code from P... Sub to End Sub, that his error was after, but even reading his posted code, its wrong everywhere ...

Set db = CurrentDb <Errors here>
Set rs = db.OpeRecordset("qryDefault")

should be


Set db = CurrentDb()
Set rs = db.OpenRecordset("qryDefault")

Also, for the loop, I'd rather use:

With rst
If Not (.EOF And .BOF) Then
.MoveFirst
Do Until .EOF
Print #1, rs!Project & rs!font_color
.MoveNext
Loop
End If
.Close
End With
Set rst = Nothing
Set DB = Nothing

...

comments ?
 

Users who are viewing this thread

Back
Top Bottom