Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2008

Tip: Looking for answers? Try searching our database.

Error on Empty Table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DS - 31 Jul 2008 16:02 GMT
I have these two DSum statements that I get an Error on because the table is
Empty.

Me.TxtDebit = Nz(DSum("[GiftAmount]", "tblGiftCardDetails", "GiftCardNumber
= " & Forms!frmFXGiftManager!TxtGiftID And GiftDebit = -1), 0)

Me.TxtCredit = Nz(DSum("[GiftAmount]", "tblGiftCardDetails", "GiftCardNumber
= " & Forms!frmFXGiftManager!TxtGiftID And GiftDebit = 0), 0)

When I try to run the code.  The VBA editor pops up with the DSum in yellow.
When I put th ecursor over the GiftDebit field in the statement it says
empty.  How can I fix this?
Thanks
DS
DS - 31 Jul 2008 16:11 GMT
Maybe its not that complicated.  It's saying Error Code 13 Type Mismatch.
Thanks
DS
Dirk Goldgar - 31 Jul 2008 20:55 GMT
(re-posting -- I don't see my original reply)

>I have these two DSum statements that I get an Error on because the table
>is Empty.
[quoted text clipped - 10 lines]
> yellow. When I put th ecursor over the GiftDebit field in the statement it
> says empty.  How can I fix this?

I don't think it's because the table is empty.  I think it's because your
criteria argument is malformed.  Am I right in thinking that GiftDebit is a
field in the table, and you want to sum records where the GiftCardNumber
field is equal to the TxtGiftID value from the form, and the GiftDebit field
= -1 (True) in one case, and 0 (False) in the other case?  If so, then try
these versions of the statements instead:

   Me.TxtDebit = _
       Nz(DSum("[GiftAmount]", "tblGiftCardDetails", _
           "GiftCardNumber = " & Forms!frmFXGiftManager!TxtGiftID & _
           " And GiftDebit = -1"), 0)

   Me.TxtCredit =
       Nz(DSum("[GiftAmount]", "tblGiftCardDetails", _
           "GiftCardNumber = " & Forms!frmFXGiftManager!TxtGiftID & _
           " And GiftDebit = 0"), 0)

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

DS - 31 Jul 2008 23:17 GMT
Woks great.
Thank You once again.
DS
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.