Refering to a table in VBA

Talon

New member
Local time
Today, 00:38
Joined
Feb 3, 2006
Messages
5
What im trying to do is to refer to the total number of records in a table using count function >.< in VBA because i need to use >.< the value of the total number of records for a calculation in VBA thx
 
I am not sure how you mean can you enlight me any futher.

Alastair
 
Searching the forum is a great way to discover and learn the answers to your Access programming questions.

You want to use the DCount() function.

Code:
X = DCount("*", "YourTableNameHere")

The Access VBA helpfiles and also MSDN.com or Microsoft.com are great resources to search and learn.
 
Basically what i've done is this:

PercentageEbay = DCount("[Cust_id]", "Order", "[Cust_id] = 8") * 100 / OpenRecordset("tblOrder").Count
Now basically what it does is count the number of records with cust_id =to 8 in the order table. What i want it to do is then times this by 100 and divide by the total number of records in the order table to give me a percentage
thx a lot
 
its a rather specific question and i did try search the forum for an answer but all i got was openrecordset which i tried sorry about the trouble thx.
 
Try

Code:
PercentageEbay = DCount("*","Order","[Cust_id] = 8")*100/DCount("*","Order")

RV
 

Users who are viewing this thread

Back
Top Bottom