Is InvoiceID a number type?
Why would you save aggregate data instead of calculating it when needed?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
If you don't have a textbox on the form named InvoiceID, then you can't use the ME Dot syntax. Use this instead:
TmpPmt = Nz(DSum("Amount","PaymentsT","InvoiceID=" & [InvoiceID]),0)
As long as InvoiceID is a number, wouldn't it be
Nz(DSum("Amount", "PaymentsT", "InvoiceID = " & InvoiceID & ""),0) ?
I'm not sure you can use Me in a domain lookup criteria.
EDIT: After testing in immediate window, I see that the double quotes are not needed after the control concatenation. Interesting. So maybe the Me works? I will have to test that.
EDIT2: OK, so elsewhere that I read, they lied. It does work either way.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
Hi June7
InvoiceID is an autonumber field and shows in a textbox on the invoice frm.
If control isn't named InvoiceID but field is, Me. will still work. I don't see anything wrong with syntax. I tested code and cannot replicate error.
Again, why save this aggregate calc?
@Micron, no reason to concatenate empty string to number. Certainly the Me. works in VBA that is constructing domain aggregate function arguments.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
It i part of a Query that runs on the invoice form showing the payments and oustanding balance on the inovice itself. If I remove the line completely the erro disapears but shows up for the currentDb line.
Doesn't alter my viewpoint. The data should be calculated when needed, not saved. Calculating a balance is a common topic.
Aside from that, have you step debugged? Do the variables set to expected values?
You will probably have to provide db for analysis.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
The double quotes were intended to result in a single ending one, not an empty string. Normally I would have used """ (3) but IIRC that raised an error. In retrospect, I agree that it was simply an empty string.
Here is theDb Guys. Whn log in use Admin and Admin
That download cannot be assembled into a working database.
We need 2 files, the Front End and the Back End. Nothing else.
The file extracts into the folder where EVERYTHING is. Just copy the folder SIO Accounting to the C:\ and open the mainFE file
How do I replicate issue? Opened form and code runs without error.
Why does invoice 12 show an amount of 218.50 but a balance of 2185.00?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
I have n idea why that invoice shows that....weird.
If you open a quote and hit the red button it should transer verythig fro th quote into a new invoice. The button is hidden at th moent till it rks.
I don't like and never use Navigation form.
You are loading form InvoiceDataEntryF with no InvoiceID parameter so of course it fails. I see 2 options:
1. First save record to Invoice table then open Invoice form with InvoiceID filter. This is complicated because retrieving the newly created InvoiceID is tricky.
2. Instead of Quote form code setting values of field on Invoice form, pass the QuoteID to Invoice form and have code behind Invoice form pull data from Quote record and set its fields. Open Invoice form to a new record and use OpenArgs argument to pass QuoteID.
DoCmd.OpenForm "InvoiceDataEntryF", acNormal, , , acFormAdd, acWindowNormal, Me.QuoteID
Then code behind Invoice form:
If Me.NewRecord And Not IsNull(Me.OpenArgs) Then
'code to open recordset of single Quote record and populate Invoice fields
Else
'other code
End If
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.