Results 1 to 7 of 7

Thread: [RESOLVED] VB6 Datareport

  1. #1
    New Member
    Join Date
    Aug 12
    Posts
    5

    Resolved [RESOLVED] VB6 Datareport

    Hi all Greetings!
    I would like some help with the following.
    I have a datareport based on data member Command. This has many fields all work very well.
    I have 2 fields, Pregnancy and Num. of Children.
    If sex field is Female then it will show Preg. and num. of children which is correct
    It also shows Pre. and Num. of children for sex male also.
    If Sex field is Male then pregnancy and Num. of Children field should not be visible
    Can you help me to do this
    Thanks and regards
    marooned2012

  2. #2
    New Member
    Join Date
    Aug 12
    Posts
    5

    Unhappy Re: VB6 Datareport

    hi all
    I posted this new thread 2 days ago and I have spent many many hours working on his without any positive outcome. I would appreciate any help immensely. if any clarification is needed I will try to explain the best way I know.

    Thank you all

  3. #3
    Frenzied Member
    Join Date
    Jan 09
    Location
    Watch Window(Shift+f9)
    Posts
    1,431

    Re: VB6 Datareport

    This needs proper validation .did you write anything to validate sex ?.you need to check if sex is male .then no need to check pregnancy .

  4. #4
    New Member
    Join Date
    Aug 12
    Posts
    5

    Re: VB6 Datareport

    Hi Firoz.raj
    Thanks for taking time to reply.

    >>did you write anything to validate sex ?.you need to check if sex is male
    Where do I validate Sex

    I changed the DataFormat for Preg. and Children -- Instead of Numbers changed to Cutom Format #. Now those text boxes are ok. But still relevant Labels still appear.

    This is part of the code I have but it is not working. Fires a "object does not support property or method error"

    Private Sub DataReport_Initialize()
    If DataReport11.Sections("Section1").Controls.Item("txtsex") = "Male" Then

    DataReport11.Sections("Section1").Controls("Label60").Caption = ""
    End If

    End Sub

    What I need to do now is, based on txtsex or Text2 or Text 3 value I want to set Label Captions ""
    thanks again

  5. #5
    New Member
    Join Date
    Aug 12
    Posts
    5

    Re: VB6 Datareport

    I have eventually solved this problem.
    I was trying to manipulate within data report and failed.
    The data report is based on a form.
    I referenced the form control in Data report for the if...Then as follows....

    Private Sub DataReport_Initialize()
    If frmReferral.txtFields(49).Text = "Male" Then
    DataReport11.Sections("Section1").Controls("Label60").Caption = ""
    DataReport11.Sections("Section1").Controls("Label61").Caption = ""
    End If
    End Sub

    It works perfectly
    Thanks every one

  6. #6
    Frenzied Member
    Join Date
    Jan 09
    Location
    Watch Window(Shift+f9)
    Posts
    1,431

    Re: VB6 Datareport

    it seems problem solved if so .please go to thread tools .and click Mark Thread resolved .else
    Code:
    Private Sub DataReport_Initialize()
    If frmReferral.txtFields(49).Text = "Male" Then
    	DataReport11.Sections("Section1").Controls("Label60").Caption = ""
            DataReport11.Sections("Section1").Controls("Label61").Caption = ""
    
    Elseif frmReferral.txtFields(49).Text = "Female" then
           DataReport11.Sections("Section1").Controls("Label60").Caption = "Preganancy"     'i am not sure .how you are input the data using form.  
    
    End If
    End Sub

  7. #7
    New Member
    Join Date
    Aug 12
    Posts
    5

    Re: VB6 Datareport

    Quote Originally Posted by firoz.raj View Post
    it seems problem solved if so .please go to thread tools .and click Mark Thread resolved .else
    Code:
    Private Sub DataReport_Initialize()
    If frmReferral.txtFields(49).Text = "Male" Then
    	DataReport11.Sections("Section1").Controls("Label60").Caption = ""
            DataReport11.Sections("Section1").Controls("Label61").Caption = ""
    
    Elseif frmReferral.txtFields(49).Text = "Female" then
           DataReport11.Sections("Section1").Controls("Label60").Caption = "Preganancy"     'i am not sure .how you are input the data using form.  
    
    End If
    End Sub
    Hi Firoz.raj
    Thanks for the reply. I have previously referenced forms to gather information from other forms. This thought came to mind and it worked. I did not have to use Elseif because When textfield value is not Male it functions in the normal way. I tested it many times and works perfectly. Thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •