Did you do a search on the forum - I'm sure I answered this recently - Ah, yes, here it is: thread222-613349
Check out faq222-2244 to get better answers!
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'People who live in windowed environments shouldn't cast pointers.'
1. Are you using the MS Datareport control, with name set to 'dr1'?
2. Are you running VB6 with SP5?
3. Is your label control called 'Label1' with Visible property set to True?
If all these check out, what error are you getting? If you set the label's caption at design time, does it show OK?
I guess these are the obvious ones to check, but I use that code often, and I know it works
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'People who live in windowed environments shouldn't cast pointers.'
Johnwm
sorry for posting the thread twice but as i thought i have posted it in the wrong forum i reposted it in the correct one.
I am using MS Datareport control & the name is also correct.
Regarding ur 2nd Q Are you running VB6 with SP5?
Yes, I am using Ms Windows Common Control 6.0 (SP4)
The label name is correct & the visible property is set to true.
After doing the upgrade (if necessary), can you also answer my previous <If all these check out, what error are you getting? If you set the label's caption at design time, does it show OK?>
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'People who live in windowed environments shouldn't cast pointers.'
1. If you do not set the caption value in the report's Initialize event, then you will need to call the Refresh method after setting the caption value.
2. If the label is in the details section, and there is not data to show there, then the lable will not show either, I guess.
Actually I need to pass text from a forms text box & combo box to labels in datareport using command button.
Private Sub cmdretrieve_Click()
On Error Resume Next
DataEnvironment1.rsvaredit.Close
If optbranch.Value = True Then
ssql = "select emp_earnded.*, emp_name from emp_earnded, emp_mast where emp_earnded.emp_code = emp_mast.emp_code and month = " & cbomonth.Text & " and year = " & cboyear.Text & " order by emp_earnded.br_code, emp_earnded.emp_code"
DataEnvironment1.Commands(4).CommandText = ssql
'testing
dtrvaredit.Sections(4).Controls("Label28".Caption = "hello"
dtrvaredit.Show
ElseIf optempcode.Value = True Then
ssql = "select emp_earnded.*, emp_name from emp_earnded, emp_mast where emp_earnded.emp_code = emp_mast.emp_code and month = " & cbomonth.Text & " and year = " & cboyear.Text & " order by emp_earnded.emp_code, emp_earnded.br_code"
DataEnvironment1.Commands(4).CommandText = ssql
dtrvaredit.Show
End If
1. Are you sure that your <On Error Resume Next> is not covering some other problem?
2. Are you sure that <optbranch.Value = True > ?
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'People who live in windowed environments shouldn't cast pointers.'
And the answer to my first question? Are you sure that your <On Error Resume Next> is not covering some other problem?
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'People who live in windowed environments shouldn't cast pointers.'
Johnwm
<On Error Resume Next> Is used just in case the
<DataEnvironment1.rsvaredit.Close>
is closed
It refreshes the datareport everytime the user clicks on the retrieve button.
U can just try the code mentioned below using a cmd button. It does not work
dtrvaredit.Sections(4).Controls("Label28".Caption = "hello"
If I want to check if dataenvironment1.rsvaredit is closed, I check the State with an If..Then block rather than using On Error Resume Next so, as Johnwm indicates, not to hide some other problem (been there, done that making it tough to find the real problem).
I suppose you've checked that your label is in Sections(4)
The mapping between setion numbers and names appears to be arbitrary. To be sure, use the Name of the section rather than its number.
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'People who live in windowed environments shouldn't cast pointers.'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.