Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to create a simple crystal report? Very new!!

Status
Not open for further replies.

macwan

Programmer
Apr 5, 2001
12
0
0
IN
How to create a crystal report?

I have created a standard report with all data in it in Crystal Report 4.
Then I want to invoke it through a VB form. I used following different
ways to select only required data in that report. It's not working.
What is wrong with this?
what is the correct way?
Can I have the sample coding?


private sub command1_click()
Dim s As Integer
s = Val(InputBox("Please enter emp NUMBER"))

Me.CrystalReport1.SelectionFormula = "{emp.empno} = " & s & " "
Me.CrystalReport1.Action = 1
end sub

This coding gives this error: Runtime error : "Unable to connect : Incorrect logon parameter"
And does not show the report.
OR sometimes it shows "Error in formula" which error i don't know
Or the following code:

Private sub command1_click()
Dim no As Integer

no = InputBox("Please enter emp Number")
Me.CrystalReport1.SQLQuery = "select * from emp where empno= " & no & ""
Me.CrystalReport1.Action = 1
end sub

This coding selects all the data from the table. I want to select only those
data which meets the runtime parameter.



Any suggestion will be very much helpful.
Thanks
macwan
 
Sounds like you're not making a connection to the db in your code. I don't know about CR v.4, but I use the SetLogonInfo or LogOnServer methods with v.8...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top