Newbie Desperately Needs Help PLEASE (1 Viewer)

Mansel160

New member
Local time
Today, 19:58
Joined
Feb 14, 2008
Messages
3
Hi All,

Newbie looking to learn here!
I am trying to display in a textbox the results of a query, I can get the query to work but just can't get the results to display on my form.

What I am doing is using 2 fields in the query. field 1 is simply Yes or No, field 2 is iether 1, 2, or 3. Using the query if field 1 = Yes, then count all 1's in field 2. Using the totals to count, I can see the results of all the 1's being counted correctly, but am unable to display the results in my form. If it helps the query is saved as class one. the Field 1 is called Car Class and field 2 is called whole season.

Many thanks for anyone who is able to help.

Mansel160
 

Mansel160

New member
Local time
Today, 19:58
Joined
Feb 14, 2008
Messages
3
Many thanks

Thanks for your help Paul and thanks Adam.

Mansel160
 

Mansel160

New member
Local time
Today, 19:58
Joined
Feb 14, 2008
Messages
3
DLookup

Hi Paul,

I tried the DLookup as suggested, I get a #Name Error. I have checked and double checked the syntax and all is ok. I have a query which has 1 as the criteria and yes as the criteria in another field then do a count on the field containing the 1's this works ok. But just can't get DLookup to work. All I need is a textbox to display the results of the count in my query. Any ideas would be great thanks.

Mansel160
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 11:58
Joined
Aug 30, 2003
Messages
36,139
It would help to see what you've got that returns the error.
 

bloomy555

New member
Local time
Today, 11:58
Joined
Jan 27, 2008
Messages
8
Hi Paul,

I tried the DLookup as suggested, I get a #Name Error. I have checked and double checked the syntax and all is ok. I have a query which has 1 as the criteria and yes as the criteria in another field then do a count on the field containing the 1's this works ok. But just can't get DLookup to work. All I need is a textbox to display the results of the count in my query. Any ideas would be great thanks.

Mansel160

add this code to a button on your form:

dim db as DAO.Databaase
Set db = CurrentDb
Dim rc As DAO.Recordset
Set rc = db.OpenRecordset("nameofyourquery") 'the name should be without spaces

Text1.Value = rc.Fields(0)


of course, you should have DAO added to the reference of your Access VB.
 

Users who are viewing this thread

Top Bottom