i don't know why this message appears!!

grad2009

Registered User.
Local time
Today, 04:32
Joined
Feb 7, 2010
Messages
30
hello guys,

In my stock database, i created a form that contanins the customers names in a combobox and a button, when i click the button it shows a message with an address "Enter Parameter Value" and ask the user to enter the customer's name.

the code bellow is the code that is in the click event of the button.
Code:
[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]If IsNull([Combo5]) Then
MsgBox "you should choose the customer at first", vbCritical, "warning"
Else
Dim I As Integer
ProgressBar.Visible = True
For I = 1 To 10000
ProgressBar.Value = I
If I = 10000 Then
ProgressBar.Visible = False
End If
Next I
DoCmd.OpenReport "balance2", acViewPreview, , "[customerName]='" & Me.Combo5 & "'"[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]

the report i want to open in the click event is balance2, the sql code of that report as the following:

Code:
[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]SELECT Customers.customerNo , Customers.customerName as , Sales.sInvoiceNo as , Sales.sDate as , Sales.total as credit, 0 as debit,  [credit] - [debit] as balance 
FROM Customers INNER JOIN Sales ON Customers.customerNo = Sales.customerNo[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]
UNION SELECT Customers.customerNo, Customers.customerName, Payment.paymentNo, Payment.pDate, 0 as credit, Payment.amount as debit,  [credit] - [debit] as balance 
FROM Customers INNER JOIN Payment ON Customers.customerNo=Payment.customerNo[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]
UNION SELECT Customers.customerNo, Customers.customerName, Received.receiptNo, Received.rDate, Received.amount as credit, 0 as debit,  [credit] - [debit] as balance 
FROM Customers INNER JOIN Received ON Customers.customerNo = Received.customerNo;[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]

what i want: when i click the button i don't want the message to appear, and when i choose the customer i want to view it's account.
i don't know what's the problem.

in the attachment is the image of the form that i'm talking about.
please help me
i'll be so thankful for you
thanks with regards,
 

Attachments

Look at the first SELECT query, you were creating an alias without giving the alias a name:

Code:
Customers.customerName[COLOR=Red][B] as [/B][/COLOR]
Get rid of all the " as".

Also, for you using a union looks like there might be a problem with how your data is normalized.
 

Users who are viewing this thread

Back
Top Bottom