Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I hv created crystal report 8 in vb6....

I'm having cmbloc(combo box) shows list of locations,I did code to show that

if cmbloc is empty or has selected value then location field on crystal report sh'd display text as "all locations"..........

But error occurs : object required at the given line......

If particular code removed then location field shows by default location of first record.... plz help

VB
Private Sub CmdRpt6_Click()
 SQL = "SELECT NOTE.*,LOCATION.LOC_NAME From NOTE,LOCATION "
 SQL = SQL + " Where NOTE.LOC_ID=LOCATION.LOC_ID"
 Set RS = CON.Execute(SQL)

 Report6.Database.LogOnServer "pdsORA7.dll", "soft", "", "aus", "aus123"
 Report6.DiscardSavedData

 If CmbLoc = Empty Or CmbLoc.Text = "<ALL LOCATIONS>" Then
   Report6.Field9.Value = "ALL LOCATIONS" // ERROR LINE : OBJECT REQUIRED
 End If
 Report6.SQLQueryString = SQL
 Report6.ReadRecords
 CRViewer1.ReportSource = Report6
 CRViewer1.ViewReport
End Sub
Posted
Updated 17-Apr-13 0:37am
v3
Comments
CHill60 17-Apr-13 7:06am    
You're trying to set Field9.Value before Field9 exists. Try moving that code to after Report6.ReadRecords or adjust the SQL you are using - you are always getting every note regardless of location so it's not clear what the relevence of cmbLoc is
surkhi 17-Apr-13 8:30am    
Moving that code after Report6.ReadRecords it's showing error as it was,even I'm unable to bind into sql......
n Bydefault location displays first note's location from the list of note records displayed...

1 solution

Hi
You can use parameter filed from Crystal Report and for do it please check the follow of links:

http://www.vb6.us/tutorials/using-crystal-reports-vb6-tutorial[^]

http://stackoverflow.com/questions/8034308/how-to-pass-parameter-field-to-command-query-in-crystal-reports-8-5[^]

you have another solution to get more information about it check it :
http://www.vbforums.com/showthread.php?431746-Crystal-Report-In-VB[^]

Best Regards.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900