-
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.
-
helpppppppppppppppppppppp!!!
-
plsssssss
can anyone knows why? im not using data environment...
-
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
-
1 Attachment(s)
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.
-
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