Saving unbound fields in a subform

JeffreyDavid

Registered User.
Local time
Today, 06:10
Joined
Dec 23, 2003
Messages
63
:confused:
I have a form and a subform and the fields in my subform are unbound. I have a save button at the bottom of my form and am trying to code my save button. Here is the top of my code for the save button:

Dim dbs As Database
Dim rss As Recordset

Set dbs = CurrentDb
Set rss = dbs.OpenRecordset("Orders", dbOpenDynaset)
With rss
.AddNew
!EntryDate = txtEntryDate
!SalesPerson = cmbSalesPerson
!CustCode = txtCustCode
Now how do I tell it that I want to save the fields in the subform?
 
They are unbound because I have one field (ProjectNo) that doesn't get issued until the save button is clicked. And if they are bound, the 'Project' table gets very messy, it doesn't record the whole record on the same line, if the form is opened and closed without any entry, it records a blank line in the Project table, just very messy.
 
Here's an example from my DB

Private Sub cmdSave_Click()

Dim db As DAO.Database
Dim rstQuickTicket As DAO.Recordset

If IsNull(Me.txtContact) Or IsNull(Me.txtMessage) Then

MsgBox "The Contact name and Message description must be filled in!"

Else

Set db = CurrentDb()

Set rstQuickTicket = db.OpenRecordset("tblTickets", dbOpenDynaset)

With rstQuickTicket
.AddNew
!CustomerId = Me.txtStoreNum 'Data pulled from form.
!ProblemDescription = Me.txtMessage 'Data pulled from form.
!Contact = Me.txtContact 'Data pulled from form.

!AssignedTo = "MCD-Open"
!Subject = "QT: Referred to Sales"
!Priority = "Low"
!Status = "Resolved"
!Resolution = "Referred to Sales"
!LastModifiedBy = CurrentUser()
!LastDateModified = Now()
!ProblemType = "Non-Incident - POS"
!ProblemArea = "Other"
!ProblemDetail = "Referred to Sales"
!CallTakenLive = True
!ContractHelpdesk = Me.txtHelpdesk 'Data pulled from form.
!ContractEquipment = Me.txtEquipment 'Data pulled from form.
!ContractPOS = Me.txtPOS 'Data pulled from form.
!ContractISP = Me.txtISP 'Data pulled from form.
!OpenPriority = "Low"
!DateOpenNew = Now()
!DateOpenWorking = Now()
!DateResolved = Now()
!UserOpenNew = CurrentUser()
!UserOpenWorking = CurrentUser()
!UserResolved = CurrentUser()
.Update
End With

DoCmd.Close

End If

End Sub
 

Users who are viewing this thread

Back
Top Bottom