Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: how to give data at run time in crystal report 10 Post Reply Post New Topic
Author Message
muddasirmunir
Newbie
Newbie


Joined: 21 Oct 2007
Location: Pakistan
Online Status: Offline
Posts: 13
Quote muddasirmunir Replybullet Topic: how to give data at run time in crystal report 10
     Posted: 04 Dec 2008 at 2:56am
I am using vb6 and crystal report 10.

In my report i want that the page number of the page should not start with 1 ,rather with number given by user. for which i made a formula field with the coding

 
NumberVar startNum := 5;
"Page " + ToText((PageNumber + startNum), 0)


Now it work fine,but using the above formula page number always start with 6.

I want that the page number now has to start with the number given by the user at run time.for this i had tried this formula

NumberVar startNum := salesfrm.startpageno.text;
"Page " + ToText((PageNumber + startNum), 0)


where salesfrm is the form at which by clicking user open report and startpageno is a text field at salesfrm form.

But got error.

can any body correct the mistake OR there is some other way to add or subtract some number in a particular field in crystal report.


Thanks
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 04 Dec 2008 at 6:12am
My answer will seem silly.
 
Since Crystal always starts at page 1 and you want the page number to start at the value given, just subtract 1, so
 
NumberVar startNum := 5;
"Page " + ToText((PageNumber + startNum - 1), 0)
 
This should start at 5 and increment as desired...or did I miss something?
 
Hope this helps
IP IP Logged
muddasirmunir
Newbie
Newbie


Joined: 21 Oct 2007
Location: Pakistan
Online Status: Offline
Posts: 13
Quote muddasirmunir Replybullet Posted: 04 Dec 2008 at 7:45am
You are right but my question is not that the page number is starting with 5 or 6 its a simple plus minus game rather my question is,
 
 if i make a formula field and write the code
 
NumberVar startNum := 5;
"Page " + ToText((PageNumber + startNum), 0)
 
then page number always start with 6 ok now i want the user to give option at run to to choose the page number to start with.
I am not getting right how to code it that it will accept parameter at run time from user.Even by asking like input box in vb6 or some other way so the user can give at run time the page number to start.
 
Hope now you understand what i actually want.
 
Thanks
 
 
 


Edited by muddasirmunir - 04 Dec 2008 at 7:47am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 04 Dec 2008 at 8:02am
OK, sounds like you want to set a parameter.  Create a parameter, startnum and use that in your formula.
 
How to get the user input, if called from vb...I don't know the vb6 syntax but in .net it would be similar to:

Dim rptFS As New yourReportName

rptFS.SetParameterValue("@The parameter name created above", uservalueFromControl)

Hope this is more along the lines of what you were looking for.
IP IP Logged
muddasirmunir
Newbie
Newbie


Joined: 21 Oct 2007
Location: Pakistan
Online Status: Offline
Posts: 13
Quote muddasirmunir Replybullet Posted: 05 Dec 2008 at 2:00am
.net will not work,  can any body else help me.
i am again telling what i actully want simple  look at this code
 
NumberVar startNum := 5;
"Page " + ToText((PageNumber + startNum - 1), 0)
 
The code works fine i just want that instad of 5 i want the user can give any number at run time.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum