Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute query from VBA

Status
Not open for further replies.

karren

Programmer
Feb 26, 2002
42
CA
I am trying to print the value from a query on my form.

So, I have a text box on the ClaimClient_MainForm form called ClaimCount.

My query goes like this:

dim sql as string
sql=SELECT Claim.ClientID, Count(Claim.ClaimID) AS CountOfClaimID
FROM Claim
GROUP BY Claim.ClientID
HAVING (((Claim.ClientID)=[forms]![ClaimClient_MainForm]![ClientID]))

I would like the value of ClaimID to write to the ClaimCount text box on my form.

How do I execute this query and make this little write statement happen?

Thanks,
Julie
 


Here is what I would do. CountClaim is a textbox

me.CountClaim = dcount("ClainID", "Claim", "ClientID = "_
& forms![ClaimClient_MainForm]![ClientID] )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top