Having problems using DCount

G

Guest

I want to create a Dcount that will display the amount of orders that there
has been for that particular customer.
But I want it decide which customer i am counting based on a combobox that
has the customer information. I am trying to add this onto the NORTHWIND
database, and i want it to use the combobox that i choose the customer from
to decide. I nead this to be on the orders form.
Can someone please show me an example of the code that i should use. the
table names and the field names are the same as on the northwind database.

thank you
 
K

Ken Snell [MVP]

Generic (hint: it helps if you provide actual names when you post) example:

If the combo box is a numeric value:
MyCount = DCount("*", "TableName", "FieldName=" & Me.ComboboxName.Value)

If the combo box is a text value:
MyCount = DCount("*", "TableName", "FieldName='" & Me.ComboboxName.Value &
"'")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Automatic Updates 4
adding records to a sub form 2
Table Structure 2
Northwind DB instructions 1
Log on form 1
Customer Orders Database 2
Select the "older" cell 1
Displaying Information From a Table in a Form 4

Top