Hi Everyone,
Im New here,
I am trying to copy the contents of a subform(Datatsh eet view)and populate the subform(datashe etview) on the next screen with the contents it just copied from the previous subform(Datashe et view).
the purpose is if the billing choices are the same for the next individuale beeing entered into the db insteead of having to re-type everything. the code I have only copies the last record in the subform (DataSheet view)
[CODE=vb]Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "VMSU-IL"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Dim loDb As DAO.Database
Dim loRst As DAO.Recordset
Set Lsub = Forms![VMSU-IL]![InvoiceSubform]
Set loRst = CurrentDb.OpenR ecordset("SELEC T * FROM [VMSU-ILT-Sub] WHERE" _
& " [IDNumber]= '" & Me.[IDNumber] & "';", dbOpenDynaset)
Dim I As Long
With loRst
Do Until .EOF
Lsub![Billing for] = .Fields("billin g for") & vbup
Lsub![Quantity] = .Fields("Quanti ty")
Lsub![Transaction order number] = .Fields("TO Number")
.MoveNext
Loop
End With
loRst.Close
Set loRst = Nothing
Set loDb = Nothing
DoCmd.Close acForm, "VMSU-ILQ", acSaveNo
stDocName = "VMSU-IL"
DoCmd.OpenForm stDocName, , , stLinkCriteria
ErrorHandler:
If Err.Number = 3021 Then
Resume Next
End If
End Sub[/CODE]
Im New here,
I am trying to copy the contents of a subform(Datatsh eet view)and populate the subform(datashe etview) on the next screen with the contents it just copied from the previous subform(Datashe et view).
the purpose is if the billing choices are the same for the next individuale beeing entered into the db insteead of having to re-type everything. the code I have only copies the last record in the subform (DataSheet view)
[CODE=vb]Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "VMSU-IL"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Dim loDb As DAO.Database
Dim loRst As DAO.Recordset
Set Lsub = Forms![VMSU-IL]![InvoiceSubform]
Set loRst = CurrentDb.OpenR ecordset("SELEC T * FROM [VMSU-ILT-Sub] WHERE" _
& " [IDNumber]= '" & Me.[IDNumber] & "';", dbOpenDynaset)
Dim I As Long
With loRst
Do Until .EOF
Lsub![Billing for] = .Fields("billin g for") & vbup
Lsub![Quantity] = .Fields("Quanti ty")
Lsub![Transaction order number] = .Fields("TO Number")
.MoveNext
Loop
End With
loRst.Close
Set loRst = Nothing
Set loDb = Nothing
DoCmd.Close acForm, "VMSU-ILQ", acSaveNo
stDocName = "VMSU-IL"
DoCmd.OpenForm stDocName, , , stLinkCriteria
ErrorHandler:
If Err.Number = 3021 Then
Resume Next
End If
End Sub[/CODE]
Comment