Results 1 to 6 of 6

Thread: data report in vb

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Location
    philippines
    Posts
    81

    data report in vb

    im stucked on this error, can anyone help me...

    Code:
    Private Sub Command1_Click()
    Dim strsql As String
    
    If Option1.Value = True Then
    
    Set rs = New Recordset
    strsql = "SELECT [Progress Notes].[Patient ID], [Progress Notes].time, [Progress Notes].DatePN, [Progress Notes].Diagnosis, [Progress Notes].[Progress Notes], [Progress Notes].PNSHEET, [Patient Personal Information].Name, [Patient Personal Information].[Maiden Name], [Patient Personal Information].Surname, [Patient Personal Information].Sex, [Patient Personal Information].Age FROM [Patient Personal Information] INNER JOIN ([Patient Medical Profile] INNER JOIN ([Patient Family History] INNER JOIN [Progress Notes] ON [Patient Family History].[Patient ID] = [Progress Notes].[Patient ID]) ON [Patient Medical Profile].[Patient ID] = [Patient Family History].[Patient ID]) ON [Patient Personal Information].[Patient ID] = [Patient Medical Profile].[Patient ID] where [progress notes].[patient id]='" & txtptid.Text & "'"
    With rs
        .ActiveConnection = db
        .CursorLocation = adUseClient
       .Open strsql, db, adOpenStatic, adLockOptimistic
    End With
    
    With RptPatientPrognotes
    Set .DataSource = rs
        .DataMember = ""
          
    With .Sections("Section2").Controls
      .Item("txtname").DataField = rs("name").Name
      .Item("txtptid").DataField = rs("patient id").Name
      .Item("txtmaiden").DataField = rs("maiden name").Name
      .Item("txtsurname").DataField = rs("surname").Name
      .Item("txtage").DataField = rs("age").Name
      .Item("txtsex").DataField = rs("sex").Name
    End With
    
    With .Sections("Section1").Controls
            .Item("txtdate").DataField = rs("datepn").Name
            .Item("txtdiag").DataField = rs("diagnosis").Name
            .Item("txtnotes").DataField = rs("progress notes").Name
    
    End With
      .Refresh
      .Show
    End With
    
    End If
    Set RptPatientPrognotes.DataSource = rs
    RptPatientPrognotes.Show
    End Sub

    when i debug it, it focus on the .refresh.

    error:

    run-time error '8551';

    Control 'txtname' cannot be placed on this section.
    DSN

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Location
    philippines
    Posts
    81
    helpppppppppppppppppppppp!!!
    DSN

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Location
    philippines
    Posts
    81

    plsssssss

    can anyone knows why? im not using data environment...
    DSN

  4. #4
    Junior Member
    Join Date
    Sep 2003
    Location
    BH
    Posts
    22
    Would you please send it in a zip file..
    then there may be a chance for knowing the exact pro.

    there are many propublities..
    i think you have to put this in the starting

    Load RptPatientPrognotes

    OR
    Execute it like this
    With .Sections("Section2")
    .Controls("txtname").DataField = rs("name").Name
    .Controls("txtptid").DataField = rs("patient id").Name
    .Controls("txtmaiden").DataField = rs("maiden name").Name
    .Controls("txtsurname").DataField = rs("surname").Name
    .Controls("txtage").DataField = rs("age").Name
    .Controls("txtsex").DataField = rs("sex").Name
    End With
    Last edited by mohdk_bh; Sep 6th, 2003 at 09:15 AM.
    I'ts not so much where you stand in life, but in what direction you are moving

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Location
    philippines
    Posts
    81
    now it says report sections doesnt match data source...

    i can't include the file since its so big..


    i've included a snapshot picture of the report though... here it is.
    Attached Images Attached Images  
    DSN

  6. #6
    Junior Member
    Join Date
    Sep 2003
    Location
    BH
    Posts
    22
    aha.. so now every thig related to the design is correct

    but the way it's connected to the data souce is not..
    so you have two solution

    one is:
    it's better to remove the group header/footer.. and put the patients informtion up in the report or page header,, the send the information with this manual code:
    Code:
    report.sections("Section2").controls("lblName").caption= txtname.text
    but this way is usefull and easy in a way if you wanna show one patients info...
    not a family one by one..


    second:
    you have to use dataenvironment for connecting with the report
    for more information go to
    http://msdn.microsoft.com/library/de...portObject.asp

    i hope this will solve your problem
    bro
    I'ts not so much where you stand in life, but in what direction you are moving

Posting Permissions

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



Click Here to Expand Forum to Full Width