Compile Error on rst.Fields("Account")

Guus2005

AWF VIP
Local time
Today, 16:53
Joined
Jun 26, 2007
Messages
2,642
Can you tell me why i get an error message on
Code:
dim rst         as recordset
dim strResult as string

[lot of stuff here]

strResult = rst.Fields("Account") '<Error: sub or Function Not defined
declaration and error jpgs are attached.

Thanks!
 

Attachments

I couldn't get this to work using fieldnames. However if I used the field number starting from 0 for the leftmost it returned the correct content for that field in the current record.

ie strResult = rst.Fields(0) returned the key of the first record from my table
 
Well i don't get the error message all the time and as you can see from the attached pictures this property was already used a few lines earlier.

I tried compacting and repairing but that didn't work.
I am going to boot now!
 
Boot didn't work.
Still get the error message which is b.t.w Error 35
 
What is your function expecting? By how you pass this, it could be either a field object or the value property, but it'd probably be more interesting seeing the actual code.

What happens if you try to be more explicit TheFunction(rst.Fields("MyField").Value / 1000) ?

Try /Decompile too, for detailed instruction, see http://www.granite.ab.ca/access/decompile.htm (note, before step 3, close all instances of Access, reopen without running any code (shift) before doing the compact)
 
When you copy code, copy everything!

What happens if you try to be more explicit TheFunction(rst.Fields("MyField").Value / 1000) ?
Being more explicit did the trick.

The error started here:
Code:
lngSecActual = RoundLng(rstSecActual.[COLOR="Red"]Fields[/COLOR]("Actual") / 1000)

Being more explicit shifts the error message to here:
Code:
lngSecActual = [COLOR="red"]RoundLng[/COLOR](rstSecActual.Fields("Actual").Value / 1000)
I missed this function...

Thanks for the input, RoyVidar.
 

Users who are viewing this thread

Back
Top Bottom