Help with recordset code (1 Viewer)

eason

Registered User.
Local time
Today, 03:28
Joined
Nov 3, 1999
Messages
31
This is my code.

Private Function GetSum(GLORG as String)
Dim rst as Recordset
Dim stSQL as String

stSQL = "Select MonthSum Form CMonthqry Where GLORG='" & GLORG & "'"
Set rst = CurrentDB.Openrecordset(stSQL)
Get GLORG = rst.Field("MonthSum")

End Function

GLORG is a six diget number and CMonthqry is a dallor amount. Can anyone tell me why I'm getting a error message when I run the report?
 

Topher

Registered User.
Local time
Today, 09:28
Joined
Apr 18, 2000
Messages
72
you might be able to get away with taking out the delimiters - apostrophes - being a number it doesnt need them. however if the field the number is in (in the table) is a string it would need them. also it might have to be converted from an number to a string before the sql statement can be processed....

hope this helps, let me know if it worked and what worked!
 

Users who are viewing this thread

Top Bottom