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.




Reply With Quote