Greetings,
I have an unbound form in which there is an subform. I used ADO to sucessfully add a new record to a table, but I'm not sure how to get the subform's record(s) to write to its table. My code is as follows...
Private Sub cmdSubmit_Click()
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
With rst
.ActiveConnection = CurrentProject.Connection
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open "Ticket" 'table name
.AddNew
![Ticket No] = Me.Ticket_No
!TicketDate = Me.TicketDate
!PO = Me.PO '...the fields continue on for a while
.Update
.Close
End With
The subform is linked to the master form by TicketNo. These records would need to write to the TicketDetails table as opposed to the Ticket table. How would I do this in the same fell swoop? Or would it be better/easier to do an SQL statement? Thanks in advance.
I have an unbound form in which there is an subform. I used ADO to sucessfully add a new record to a table, but I'm not sure how to get the subform's record(s) to write to its table. My code is as follows...
Private Sub cmdSubmit_Click()
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
With rst
.ActiveConnection = CurrentProject.Connection
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open "Ticket" 'table name
.AddNew
![Ticket No] = Me.Ticket_No
!TicketDate = Me.TicketDate
!PO = Me.PO '...the fields continue on for a while
.Update
.Close
End With
The subform is linked to the master form by TicketNo. These records would need to write to the TicketDetails table as opposed to the Ticket table. How would I do this in the same fell swoop? Or would it be better/easier to do an SQL statement? Thanks in advance.