Kamis, 09 Januari 2014

Re: [MS_AccessPros] Dcount syntax question

 

Duh.  DCount does the same thing as SELECT COUNT - and that ignores Null fields, so the count will always be 0 when looking only for Null values.


John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Jan 9, 2014, at 6:43 PM, Jim Wagner <luvmymelody@yahoo.com> wrote:

I figured it out. I added the * to the syntax. That worked great

cmdEditEmailAddr.Caption = "Edit " & DCount("*", "tblAccounts", "[EmailAddress] Is Null") & " " & "Empty email addresses"
 
Jim Wagner



On Thursday, January 9, 2014 10:34 AM, Jim Wagner <luvmymelody@yahoo.com> wrote:
 
John,

This is strange. I have opened it today and deleted 3 email addresses in the field to see if the caption shows the correct count on the button. But it shows 0 Empty email addresses on the button. Is there something I am not seeing?

Thank You
 
Jim Wagner



On Tuesday, January 7, 2014 10:30 AM, Jim Wagner <luvmymelody@yahoo.com> wrote:
 
I had to type it out. but it worked. Thank You


 
Jim Wagner



On Tuesday, January 7, 2014 10:24 AM, John Viescas <JohnV@msn.com> wrote:
 
Jim-

No way!  Copy and paste the exact code you have in a reply.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Jan 7, 2014, at 6:08 PM, Jim Wagner <luvmymelody@yahoo.com> wrote:

I get an Expected end of statement error
 
Jim Wagner



On Tuesday, January 7, 2014 9:45 AM, John Viescas <JohnV@msn.com> wrote:
 
Jim-

Your expression:

cmdEditEmailAddr.Caption = DCount("Edit "& " " & "[EmailAddress]", "tblAccounts", "EmailAddress Is Null") & " " & "Empty email addresses"

Asks for the count of a field named "Edit [EmailAddress]" which probably doesn't exist in your table.  Perhaps you mean to do:

cmdEditEmailAddr.Caption = "Edit " & DCount("[EmailAddress]", "tblAccounts", "EmailAddress Is Null") & " " & "Empty email addresses"


John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Jan 7, 2014, at 5:14 PM, Jim Wagner <luvmymelody@yahoo.com> wrote:

Hello

I have a dcount expression on the form load event that puts the count of a table on the caption of a button. In the code the second line works great, but I would like to add a word at the beginning of the dcount and everything I have tried has stopped the form from loading. Is it possible to add a word before the dcount? The first line is the one that does not work.




Private Sub Form_Load()
cmdEditEmailAddr.Caption = DCount("Edit "& " " & "[EmailAddress]", "tblAccounts", "EmailAddress Is Null") & " " & "Empty email addresses"
'cmdEditEmailAddr.Caption = DCount("[EmailAddress]", "tblAccounts", "EmailAddress Is Null") & " " & "Empty email addresses"
End Sub

Thank You
 
Jim Wagner











__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (9)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar