?
Solved

get result from 'docmd.runsql'

Posted on 2003-02-26
2
Medium Priority
?
1,002 Views
Last Modified: 2007-12-19
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
Comment
Question by:redgoalsku
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
jonsykes earned 200 total points
ID: 8023937
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
 

Author Comment

by:redgoalsku
ID: 8024034
u the man, thnx
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question