#ERROR in textbox

D

Dirk Goldgar

Alan said:
Well this morning i tired a new table completely
had three fields

Customer No as a text
Posting Date Period as a date/time
Amount as a number

two combo boxes

cbocustomerNumber
cboPostingDate
textbox

Tired this

=DSum("Amount","Table1","[Customer No] = '" & [Me].[cboCustomerNumber] &
"'
And Format([Posting Date
Period],'yyyymm') = '" & Format([Me].[cboPostingDate],"yyyymm") & "'")


and still got name, now i know that all the field are spelt correcly and
in
the right format


"Me" is not valid in a controlsource, only in VBA code. Remove the "[Me]."
qualifiers.
 
D

Daryl S

Alan -

This should be in the Control Source property of the text box.

--
Daryl S


Alan said:
Daryl

This is correct that i'm putting this code into the source data of a textbox??

i not where should i put it

thanks again i really do appricate you help, just need this to work


Daryl S said:
Alan -

I changed the cboCustomerNumber assuming it is also a combo box, and the
number is in the first field:

=DSum("[Amount]", "[July 09 - On Billings and Adjustments Data Query]",
"[Customer No] = '" & Me.[cboCustomerNumber].Column(0) & "' AND [Posting
Period Date] = '"
& Me.[cboPostingDate].Column(0) & "'")

If it doesn't work, I would suggest adding the following before the DSum so
you can see what is really being passed:

Debug.Print Me.[cboCustomerNumber].Column(0)
Debug.Print Me.[cboPostingDate].Column(0)

The results will be in the immediate window when the code runs.

Also check the exact spelling of the table and fieldnames, as we can't do
that remotely...

--
Daryl S


Alan said:
I just Get #Name error now??

Any suggestion

:

Alan -

If the field in the database is [Posting Period Date], then you have the
field name wrong. Try this:

=DSum("[Amount]", "[July 09 - On Billings and Adjustments Data Query]",
"[Customer No] = '" & [cboCustomerNumber] & "' AND [Posting Period Date] = '"
& Me.[cboPostingDate].Column(0) & "'")

I am assuming cboPostingDate is a combo box, and the date you want is in the
first column. If that date is a text value in the correct format (yyyymm),
then the above should work. If not, you will need to add formatting to that.

--
Daryl S


:

Apologies Posting Date period is a text field??

:

Is the bound column of cboCustomerNumber a number field, and are Posting Date
Period and cboPostingDate date fields?

Alan wrote:
I have this code in a text box

= dsum("[Amount]", "[July 09 - On Billings and Adjustments Data Query]",
"[Customer No] = " & [cboCustomerNumber] & " AND Format([Posting Date
Period], ""yyyymm"") = '" & Format([cboPostingDate], "yyyymm") & "'")

i keep getting #error in my text box

i'm struggling to find they answer to why

the query July 09 - On Billings and Adjustments Data Query
has fields of

customer Number
posting periood date
Amount

Now i have two combo boxes on my form which the text box should look up

Customer number and Name, are bound to another table

No (for customer Number)
Name ( for customer Name

Customer Listing Table

not linked to July 09 - On Billings and Adjustments Data Query

Is this what causing my error and how do i fix it

Thanks in advanced
 

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

Top