sanders720
Programmer
I have a recordset that I wish to use to populate my report. My problem is, it is only populating the one row located in the detail area. I am certain I am missing whatever is needed to add rows to the report in code and have them populated.
Can comeone please provide some general guidance.
Thanks for your help on this!
Private Sub GetRecordset1()
Dim rs As ADODB.Recordset
Dim sql As String
Dim c As Integer
Dim rc As Integer
sql = "SELECT * FROM TimeCards WHERE (((Timecards.Date)>=#" & txtPS.Value & "# AND (Timecards.Date)<=#" & txtPE.Value & "#) AND ((TimeCards.[Employee Number])=" & Me.txtEN.Value & "
)"
Debug.Print sql
Set rs = New ADODB.Recordset
With rs
.CursorLocation = adUseClient
.Open sql, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
.MoveLast
rc = .RecordCount
.MoveFirst
For c = 1 To rc
Me.txtJobNumber.Value = .Fields("Job Number"
Me.txtOrderNumber.Value = .Fields("Order Number"
Me.txtOperationNumber.Value = .Fields("Op Number"
MsgBox "Press Key"
.MoveNext
Next c
End With
rs.Close
Set rs = Nothing
End Sub
Can comeone please provide some general guidance.
Thanks for your help on this!
Private Sub GetRecordset1()
Dim rs As ADODB.Recordset
Dim sql As String
Dim c As Integer
Dim rc As Integer
sql = "SELECT * FROM TimeCards WHERE (((Timecards.Date)>=#" & txtPS.Value & "# AND (Timecards.Date)<=#" & txtPE.Value & "#) AND ((TimeCards.[Employee Number])=" & Me.txtEN.Value & "
Debug.Print sql
Set rs = New ADODB.Recordset
With rs
.CursorLocation = adUseClient
.Open sql, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
.MoveLast
rc = .RecordCount
.MoveFirst
For c = 1 To rc
Me.txtJobNumber.Value = .Fields("Job Number"
Me.txtOrderNumber.Value = .Fields("Order Number"
Me.txtOperationNumber.Value = .Fields("Op Number"
MsgBox "Press Key"
.MoveNext
Next c
End With
rs.Close
Set rs = Nothing
End Sub