|
-
Feb 5th, 2006, 07:23 AM
#1
Thread Starter
Hyperactive Member
what should i do with this
hi all,
actually am strugling with CRystal report .
am using this for printing students detail with name entered in text box. here am geting Runtime error :20515 and saying number, currency... expected here. i want to finalise the project this week. i feel i have to post this in report section. but to get a speedy reply posted here. sorry for all the trouble
am using VB6.0 with access, adodb and crystal report version 8
cr1.SelectionFormula = "{studdeta.name }= " & Text1.Text
cr1.Action = 1
can anybody help me out.
saj
-
Feb 5th, 2006, 11:25 AM
#2
Re: what should i do with this
Is the name field text? If so, you need to enclose the value in single quotes, ie:
VB Code:
cr1.SelectionFormula = "{studdeta.name }= '" & Text1.Text & "'"
-
Feb 5th, 2006, 11:50 AM
#3
Re: what should i do with this
-
Feb 6th, 2006, 08:15 AM
#4
Thread Starter
Hyperactive Member
Re: what should i do with this
 Originally Posted by si_the_geek
Is the name field text? If so, you need to enclose the value in single quotes, ie:
VB Code:
cr1.SelectionFormula = "{studdeta.name }= '" & Text1.Text & "'"
VB Code:
cr1.SelectionFormula = "{studdeta.name }= '" & Text1.Text & "'"
after the above code i did,
cr1.action =1
but something is displaying i cant able to see and displaying an error " CAnnot open SQL server"
actually am using msacess 2000. what should i do to display and taking print
saj
-
Feb 6th, 2006, 10:14 AM
#5
Re: what should i do with this
Are the curly brackets ( { and } ) needed for Crystal? (for normal DB work they would cause a problem).
Did the error message contain "SQL server" or was it "SQL Server" - there is a big difference, as SQL Server is a particular product, whereas a SQL server is just a database engine. Either way, if removing curly brackets doesn't work then you should check your database connection settings in Crystal.
-
Feb 8th, 2006, 06:36 AM
#6
Thread Starter
Hyperactive Member
Re: what should i do with this
 Originally Posted by si_the_geek
Are the curly brackets ( { and } ) needed for Crystal? (for normal DB work they would cause a problem).
Did the error message contain "SQL server" or was it "SQL Server" - there is a big difference, as SQL Server is a particular product, whereas a SQL server is just a database engine. Either way, if removing curly brackets doesn't work then you should check your database connection settings in Crystal.
actually what i did is... i made a report using crystal report. and in the design stage of program i insert the crystal report componet from the componect dialog box. after that right click the report control and in the properties i select the report file name. then in the command button i did the above coding. but it is showing "cannot open SQL server". no where i am mentioning database in crystal. i feel straight way am connecting to report. how can i go ahead.... removed curly then the error is "error in formula" ............... am very beginner in crystal report
saj
-
Feb 8th, 2006, 06:53 AM
#7
Re: what should i do with this
What happens if you try to run the report in Crystal application (not the Crystal component in VB)?
Have you set up a database in the report? (you need to, but I'm not sure how you do it)
-
Feb 8th, 2006, 07:12 AM
#8
Thread Starter
Hyperactive Member
Re: what should i do with this
thank u geek for ur reply..
when i run crystal report in "preview" mode it is showing all the reocrds in that table. as i told in previos post i didnt mention any database. straigt away connected to report. ..............
saj
-
Feb 8th, 2006, 07:33 AM
#9
Re: what should i do with this
Ok, but the report needs to get its data from somewhere.. is there a database set up in the report?
If so, where is this database? What happens if you refresh the report, does it get updated data?
-
Feb 8th, 2006, 08:11 AM
#10
Thread Starter
Hyperactive Member
Re: what should i do with this
 Originally Posted by si_the_geek
Ok, but the report needs to get its data from somewhere.. is there a database set up in the report?
If so, where is this database? What happens if you refresh the report, does it get updated data?
yes .... when am refreshing the report it is populating with table data. actually in the designing time itself am inserting table fields whatever i need in the report and i feel it is enough for the report to know the data is coming from. i dont know again i want to connect to database? bit confused....
saj
-
Feb 8th, 2006, 08:18 AM
#11
Re: what should i do with this
You say the report is getting data from a table... this table is in a database, where is the database?
How is it linked to the report? (I presume it will be somewhere under a 'database' or 'data' menu).
-
Feb 8th, 2006, 08:40 AM
#12
Thread Starter
Hyperactive Member
Re: what should i do with this
 Originally Posted by si_the_geek
You say the report is getting data from a table... this table is in a database, where is the database?
How is it linked to the report? (I presume it will be somewhere under a 'database' or 'data' menu).
when i am running the code from VB,
crystal.action =1 , the whole data from the table(reporting) is displaying in window.... i can able to print the data too. there is some problem in crysal.selectionformula... thats what
saj
-
Feb 8th, 2006, 11:47 PM
#13
Thread Starter
Hyperactive Member
Re: what should i do with this
yes geek,
am using crystal version 8.0
what i did is in the designing time of crystal report( file - new - standard - database file- find database file - then select the student.mdb and the one of the table in it) and saved the report with .rpt extension
after that the above code executed. its ok when am giving only cr1.action=1, the whole data in that table is displaying but when working with selectionformula showing "error in formula"
pls help me...
saj
-
Feb 9th, 2006, 04:58 AM
#14
Re: what should i do with this
Looking at various other threads in this forum (including this one) is seems that the following should be fine - the only difference is the obvious spacing issue:
VB Code:
cr1.SelectionFormula = "{studdeta.name} = '" & Text1.Text & "'"
If you still have problems, try it like this:
VB Code:
Dim strSelection as String
strSelection = "{studdeta.name} = '" & Text1.Text & "'"
Debug.Print strSelection
cr1.SelectionFormula = strSelection
..and show us what is printed to the Immediate window.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|