• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1007
  • Last Modified:

get result from 'docmd.runsql'

im using access 97 and i need to get the reult of a query that is to be run in vb.

ive tried the following but to no avail..

note: & [Mem No] &  = field in form

SQL = "SELECT Count([tblHire]![Mem No]) AS Expr1 " & _
"FROM tblHire " & _
"HAVING ((tblHire.[Mem No])='" & [Mem No] & "')"

If (DoCmd.RunSQL(SQL)) > 4 Then
...do somethin


.thnx for your help
0
redgoalsku
Asked:
redgoalsku
1 Solution
 
jonsykesCommented:
Try using a recordset instead of RunSQL:

DIM rst as recordset, SQL as string

SQL = "SELECT Count([tblHire]![Mem No]) AS Expr1 " & _
"FROM tblHire " & _
"HAVING ((tblHire.[Mem No])='" & [Mem No] & "')"

set rst = currentdb.openrecordset(SQL, DbOpenDynaset)

if rst.fields("Expr1") > 4 Then

etc...
0
 
redgoalskuAuthor Commented:
u the man, thnx
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now