Compile Error Expected: =

G

Guest

I have a simple function in my Access 2000 database that is giving me the
following error:

Compile Error Expected: =

The code is as follows:

Sub efile_cleanup()

Dim tbl As Recordset
Dim db As Database
Dim jobvar As String
Dim lastcriteria As String


Set db = CurrentDb()
Set tbl = db.OpenRecordset("QRY_CLOSED_JOBS", dbOpenDynaset)

tbl.MoveLast
lastcriteria = tbl("JOB_NO")
tbl.MoveFirst

jobvar = tbl("JOB_NO")

Do Until jobvar <> lastcriteria

'Call efile_delete_files(jobvar)
Debug.Print jobvar
tbl.MoveNext
jobvar = tbl("JOB_NO")

Loop

End Sub

Note that I commented out the function call in case that was the source of
the problem. Any ideas?

Keith
 
D

Dirk Goldgar

Keith said:
I have a simple function in my Access 2000 database that is giving me
the following error:

Compile Error Expected: =

The code is as follows:

Sub efile_cleanup()

Dim tbl As Recordset
Dim db As Database
Dim jobvar As String
Dim lastcriteria As String


Set db = CurrentDb()
Set tbl = db.OpenRecordset("QRY_CLOSED_JOBS", dbOpenDynaset)

tbl.MoveLast
lastcriteria = tbl("JOB_NO")
tbl.MoveFirst

jobvar = tbl("JOB_NO")

Do Until jobvar <> lastcriteria

'Call efile_delete_files(jobvar)
Debug.Print jobvar
tbl.MoveNext
jobvar = tbl("JOB_NO")

Loop

End Sub

Note that I commented out the function call in case that was the
source of the problem. Any ideas?

Keith

I see nothing wrong with the code you posted, and it compiles for me in
a test database. What makes you think this is the faulty code? What
line is highlighted when you click Debug -> Compile on the VB Editor's
menu bar?
 
G

Guest

Dirk,

I don't receive any error on compiling, only when I try to run the code. I
assumed that the problem was in the code included in my original post since I
get the error when I try to run the efile_cleanup() sub in the immediate
window.

Thanks,

Keith
 
D

Dirk Goldgar

Keith said:
Dirk,

I don't receive any error on compiling, only when I try to run the
code. I assumed that the problem was in the code included in my
original post since I get the error when I try to run the
efile_cleanup() sub in the immediate window.

You probably entered this in the Immediate Window:

efile_cleanup()

That's not correct syntax for calling a Sub. Write either

efile_cleanup

or

Call efile_cleanup()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top