nesting procedures

G

Guest

Need to scan a recordset and call a procedure each time thru. Error comes up "Expected Function or Variable"
Procedure TEST1 is defined underneath it, and executes properly

What am I missing

Thanks
Mik

Public Sub Test(

Dim rst As Recordse
Dim db As Databas

Set db = OpenDatabase("db5"
Set rst = db.OpenRecordset("COMPOS"

With rs
rst.MoveFirs

Do Until rst.EO
procedure TEST1(![county], ![need]
rst.MoveNex
Loo

End Wit

db.Clos
End Sub
 
J

John Spencer (MVP)

If your procedure is returning values then you need to assign the values to
something. If you don't wish to do this, then drop the parentheses. Also, I
would drop the braces around the fields (unless you have field names with
non-standard characters - such as spaces or exclamation marks). Also, What is
"Procedure" doing there?



Public Sub Test()

Dim rst As Recordset
Dim db As Database

Set db = OpenDatabase("db5")
Set rst = db.OpenRecordset("COMPOS")

With rst
.MoveFirst

Do Until .EOF
TEST1 !county, !need
.MoveNext
Loop

End With

db.Close

End Sub
 
M

Marshall Barton

Mike said:
Need to scan a recordset and call a procedure each time thru. Error comes up "Expected Function or Variable".
Procedure TEST1 is defined underneath it, and executes properly.

What am I missing ?

Thanks,
Mike

Public Sub Test()

Dim rst As Recordset
Dim db As Database

Set db = OpenDatabase("db5")
Set rst = db.OpenRecordset("COMPOS")

With rst
rst.MoveFirst

Do Until rst.EOF
procedure TEST1(![county], ![need])
rst.MoveNext
Loop

End With

db.Close
End Sub


It would be better to specify the entire path to db5 so
there's no confusion about where it's located.

Get rid of the word procedure where you call Test1. The
correct syntax is either of the following:

Call TEST1(![county], ![need])
or
TEST1 ![county], ![need]

Note that there are no parenthesis in the second style.
 

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