If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
Showing a value from a query on a form
On Thu, 22 Oct 2009 20:59:01 -0700, scottyboyb
wrote: The field I am trying to count records for is an autonumber primary key of the "Pledges" table which holds the data about the pledges made and paid by contributors (different table). The field is called PledgeID. Datatype autonumber. Well, if you are just counting records, it's not essential to count the Primary Key field: you could use =DCount("*"...) to count records. Should give the same results though. The form control that provides the form's data criteria is on a form called "Campaigns" and the form control is a text box that gets it's data from a field whose datatype is text in a table called "Donation Campaign Setup". The text box's control source is a field in "Donation Campaign Setup" called "CampaignName" and the text box's name is CampaignNameField. The control for the DCount expression is a text box on the same form "Campaigns" with the name "Total Number of Pledges". Is there anythng else you need to know? I believe so: which field in "Pledges" are you trying to match to the value in CampaignNameField? Assuming that it's Campaign and that it's a Text field, then =DCount("[PledgeID]", "Pledges", "[Campaign] = '" & Forms!Campaigns![CampaignNameField] & "'") That's two possibly incorrect assumptions there (fieldname and datatype) but hopefully you can adapt... The trick is that the third argument to any domain function needs to be a SQL WHERE clause without the word WHE in my suggestion, [Campaign] = 'Halloween Party' -- John W. Vinson [MVP] |
|
Thread Tools | |
Display Modes | |
|
|