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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
keithtbeAuthor Commented:
it still can't work
can u help me again ?
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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
raj_nbrCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.