error in formula. pls help

can u help me to solve this problem
 thanks alot


got three text box
one is for month
one is for year
one is for category

all of them are using to help me select the data in the report
the code to select the month and the year is ok
just for the category has some problem
this is for the month and the year
DataReport1.SelectionFormula = "Month({Transaction.Date})=" & mth & " and  Year({Transaction.Date})=" & yr

so for the category i have some problem

   can anyone help me deal with this
     report writer is crystal report

   another problem is in crystal report
   when i click the save to file button in the crystal report
    it cannot function
     so what is the problem?
    the print button can , just the save to file button
keithtbeAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
raj_nbrConnect With a Mentor Commented:
catagory code should have single quotes around them
like
   =' & catagorystring & "'"

Set the location of your database and use the verify option to fix any problems if any. In some cases this fixes the problem since crystal internally stores the struxcture. Covert null to default.

If, with these suggestions it doesn't work, probably, either catagory field is
not a string fied (!)  or Crystal reports is corrupted.
0
 
mark2150Commented:
You need 's around the cat

.... and transactioncategory='" & cat & "'"

That should fix your primary problem.

M
0
 
genefCommented:
DataReport1.SelectionFormula = "Month({Transaction.Date})=" & mth & " and  Year({Transaction.Date})=" & yr & " and {transaction.category}=" & cat

About save button: you can open a report for editing or as a template in Crystal. I think you're either opening it wrong or it is under SourceSafe control.

Hope it helps,
Gene
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
keithtbeAuthor Commented:
it still can't work
can u help me again ?
0
 
keithtbeAuthor Commented:
it still can't work
can u help me again ?
0
 
mark2150Commented:
All string type values need 's around them.

Can you post the actual code instead of an excerpt?

M
0
 
keithtbeAuthor Commented:
Edited text of question.
0
 
prem_kumar_25Commented:
Please try This

DataReport1.SelectionFormula = "Month({Transaction.Date}) = '" & mth & "' and  Year({Transaction.Date}) = '" & yr

Please have a close look and try .... , Or just copy the line even

Hope this will do it
0
 
keithtbeAuthor Commented:
nope kumar
i think u r misunderstaanding
what i mean is the category one got problem and not the date (month, year).anyway thanks alot.
0
 
keithtbeAuthor Commented:
can u pls tell me in more specific or give me example coz i am just a junior in vb
and i have try the way u teach me but still cannoy
anyway
thanks alot
0
 
raj_nbrCommented:
Dear Keithbe,

Category string is a "string". Crystal reports expects it ti be enclosed in quotes. In fact, this is a common practice in almost all languages. start working with the reports. You will become a master in just 3-4 days.
0
All Courses

From novice to tech pro — start learning today.