I have to create Report, witch will be fill out from RS dynamically But I can not assign Data to Text box on Report. My data will came from stored procedure SQL Server,
or from Recordset Access
This is code:
If [Forms]![FrmMenuReport]![FrmReport] = 1 Then
Me.LblReportName.Caption = "General Information"
Me.LblReportSort.Caption = "Sorted By Facility"
Me.lblReportPageHeaderSort.Caption = "SORTED BY FACILITY IN ASCENDING ORDER"
Me.LblFirst.Caption = "Report Date"
Me.Labelsec.Caption = "Last name"
Me.Labelt.Caption = "First name"
Me.LabelFour.Caption = "Book&Case Number"
Me.Labelsix.Caption = "FACILITY"
If RS.EOF And RS.BOF Then
MsgBox "No match for this selection.", vbOKOnly + vbInformation
Exit Sub
Else
Do Until RS.EOF
txtData.ControlSource = RS.Fields"Facility"
STRText = STRText & RS.Fields("Facility"
RS.MoveNext
Loop
txtData = strdate
ElseIf [Forms]![FrmMenuReport]![FrmReport] = 2 Then
Me.LblReportName.Caption = "Gender"
Me.LblReportSort.Caption = "Sorted By Gender"
Me.lblReportPageHeaderSort.Caption = "SORTED BY GENDER IN ASCENDING ORDER"
Me.LblFirst.Caption = "FACILITY"
Me.Labelsec.Caption = "Last name"
Me.Labelt.Caption = "First name"
Me.LabelFour.Caption = "Book&Case Number"
Me.Labelfif.Caption = "GENDER"
Me.Labelsix.Visible = False
If RS.EOF And RS.BOF Then
MsgBox "No match for this selection.", vbOKOnly + vbInformation
Exit Sub
Else
RS.MoveFirst
RS.MoveLast
'txtData.RowSource = RS.RecordCount - 1
'txtData.Height = RS.RecordCount - 1 * 3
'txtData.with = Len(RS.Fields("FACILITY")
Do Until RS.EOF
'txtData.Caption = txtData.Caption & RS.Fields("FACILITY" & vbCrLf
'txtData.ControlSource = "tyttyuqwt" 'RS.Fields("FACILITY"
'txtData.Caption = "dgsfjsdgfjsd"
'STRText = STRText & RS.Fields("FACILITY" & vbCrLf
RS.MoveNext
Loop
'txtData.Caption = STRText
End If
End If
I tried:
txtData=txtData & RS.Fields"Facility"& vbcrlf
txtdata=txtData & RS.Fields("Facility"
txtData.value =RS.Fields("Facility"
Every time I get msg "You can't assign a value to this object"
or from Recordset Access
This is code:
If [Forms]![FrmMenuReport]![FrmReport] = 1 Then
Me.LblReportName.Caption = "General Information"
Me.LblReportSort.Caption = "Sorted By Facility"
Me.lblReportPageHeaderSort.Caption = "SORTED BY FACILITY IN ASCENDING ORDER"
Me.LblFirst.Caption = "Report Date"
Me.Labelsec.Caption = "Last name"
Me.Labelt.Caption = "First name"
Me.LabelFour.Caption = "Book&Case Number"
Me.Labelsix.Caption = "FACILITY"
If RS.EOF And RS.BOF Then
MsgBox "No match for this selection.", vbOKOnly + vbInformation
Exit Sub
Else
Do Until RS.EOF
txtData.ControlSource = RS.Fields"Facility"
STRText = STRText & RS.Fields("Facility"
RS.MoveNext
Loop
txtData = strdate
ElseIf [Forms]![FrmMenuReport]![FrmReport] = 2 Then
Me.LblReportName.Caption = "Gender"
Me.LblReportSort.Caption = "Sorted By Gender"
Me.lblReportPageHeaderSort.Caption = "SORTED BY GENDER IN ASCENDING ORDER"
Me.LblFirst.Caption = "FACILITY"
Me.Labelsec.Caption = "Last name"
Me.Labelt.Caption = "First name"
Me.LabelFour.Caption = "Book&Case Number"
Me.Labelfif.Caption = "GENDER"
Me.Labelsix.Visible = False
If RS.EOF And RS.BOF Then
MsgBox "No match for this selection.", vbOKOnly + vbInformation
Exit Sub
Else
RS.MoveFirst
RS.MoveLast
'txtData.RowSource = RS.RecordCount - 1
'txtData.Height = RS.RecordCount - 1 * 3
'txtData.with = Len(RS.Fields("FACILITY")
Do Until RS.EOF
'txtData.Caption = txtData.Caption & RS.Fields("FACILITY" & vbCrLf
'txtData.ControlSource = "tyttyuqwt" 'RS.Fields("FACILITY"
'txtData.Caption = "dgsfjsdgfjsd"
'STRText = STRText & RS.Fields("FACILITY" & vbCrLf
RS.MoveNext
Loop
'txtData.Caption = STRText
End If
End If
I tried:
txtData=txtData & RS.Fields"Facility"& vbcrlf
txtdata=txtData & RS.Fields("Facility"
txtData.value =RS.Fields("Facility"
Every time I get msg "You can't assign a value to this object"