Results 1 to 14 of 14

Thread: what should i do with this

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    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

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    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:
    1. cr1.SelectionFormula = "{studdeta.name }= '" & Text1.Text & "'"

  3. #3

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    Re: what should i do with this

    Quote 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:
    1. cr1.SelectionFormula = "{studdeta.name }= '" & Text1.Text & "'"


    VB Code:
    1. 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

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    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.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    Re: what should i do with this

    Quote 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

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    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)

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    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

  9. #9
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    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?

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    Re: what should i do with this

    Quote 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

  11. #11
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    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).

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    Re: what should i do with this

    Quote 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

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    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

  14. #14
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    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:
    1. cr1.SelectionFormula = "{studdeta.name} = '" & Text1.Text & "'"
    If you still have problems, try it like this:
    VB Code:
    1. Dim strSelection as String
    2.   strSelection = "{studdeta.name} = '" & Text1.Text & "'"
    3.   Debug.Print strSelection
    4.   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
  •  



Click Here to Expand Forum to Full Width