1- ok, I do bind it in vb (see below)
2- no, I do not want them linked...I want them independent of each other
3- I want to display all the records from the query - independent of the main form. the main form is used to work on one record at a time and the subform is primarily used for display- to track the records being added/updated
4- yes. can I have a form to display records from a query, one at a time
and a subform using the same query, but for a different/independent reason.
certain record sources are used based on the value of an option group and combo box. once the combo box is updated, the textboxes on the form are loaded with data from the record sources. the subform record is similar, but I have it set up as a datasheet
to display several of the records.
Here is the vb code - not sure how to paste it using the same vb format in Access.
Private Sub Combo76_AfterUpdate()
Dim dbs As DAO.Database
Dim rs As DAO.Recordset
Set dbs = CurrentDb()
'here are the Master Form textboxes
Me.ReferenceNumber.ControlSource = ""
Me.txtID.ControlSource = ""
Me.txtDate.ControlSource = ""
Me.EVEntry.ControlSource = ""
Me.VendorID.ControlSource = ""
Me.AccountNumber.ControlSource = ""
Me.ItemAmount.ControlSource = ""
Me.ReferenceAmount.ControlSource = ""
Me.Payee.ControlSource = ""
'check the option in the Option Group
If Me.Frame80.Value = 1 Then
'check the value in the ComboBox76
If Combo76.Text = "jgas-bsb" Then
'set the record source
Me.RecordSource = "Bank-JGAS-bsb Query"
'put the value of the ID field to this textbox on the form
Me.txtID.ControlSource = "ID"
'put the value of the Check Number to this textbox on the form
Me.ReferenceNumber.ControlSource = "Check Number"
'put the value of the Amount Debit to this textbox on the form
Me.ItemAmount.ControlSource = "Amount Debit"
'set the record source
Me.Child78.SourceObject = "Query.JGAS_Transactions_Query"
ElseIf Combo76.Text = "jgas-cit" Then
Me.RecordSource = "Bank-JGAS-cit Query"
Me.txtID.ControlSource = "ID"
Me.ReferenceNumber.ControlSource = "Serial Number"
Me.ItemAmount.ControlSource = "Amount"
Me.Child78.SourceObject = "Query.JGAS_Transactions_Query"
ElseIf Combo76.Text = "jgas-mnb" Then
Me.RecordSource = "Bank-JGAS-mnb Query"
Me.txtID.ControlSource = "ID"
Me.ReferenceNumber.ControlSource = "Check Number"
Me.ItemAmount.ControlSource = "Debit Amount"
Me.Child78.SourceObject = "Query.JGAS_Transactions_Query"
ElseIf Combo76.Text = "jgas-mnb-pr" Then
Me.RecordSource = "Bank-JGAS-mnb-pr Query"
Me.txtID.ControlSource = "ID"
Me.ReferenceNumber.ControlSource = "Check Number"
Me.ItemAmount.ControlSource = "Debit Amount"
Me.Child78.SourceObject = "Query.JGAS_Transactions_Query"
ElseIf Combo76.Text = "can-bsb" Then
Me.RecordSource = "Bank-Can-bsb Query"
Me.txtID.ControlSource = "ID"
Me.ReferenceNumber.ControlSource = "Check Number"
Me.ItemAmount.ControlSource = "Amount Debit"
Me.Child78.SourceObject = "Query.Checks-Cannon"
ElseIf Combo76.Text = "can-cit" Then
Me.RecordSource = "Bank-Can-cit Query"
Me.txtID.ControlSource = "ID"
Me.ReferenceNumber.ControlSource = "Serial Number"
Me.ItemAmount.ControlSource = "Amount"
Me.Child78.SourceObject = "Query.Checks-Cannon"
ElseIf Combo76.Text = "can-mnb-pr" Then
Me.RecordSource = "Bank-Can-mnb-pr Query"
Me.txtID.ControlSource = "ID"
Me.ReferenceNumber.ControlSource = "Check Number"
Me.ItemAmount.ControlSource = "Debit Amount"
Me.Child78.SourceObject = "Query.Checks-Cannon"
End If
'do this if the option group value is this
ElseIf Me.Frame80.Value = 2 Then
If Combo76.Text = "jgas-bsb" Or Combo76.Text = "jgas-cit" Or Combo76.Text = "jgas-mnb" Or Combo76.Text = "jgas-mnb-pr" Then
Me.RecordSource = "JGAS_Transactions_Query"
Me.txtID.ControlSource = "ID"
Me.ReferenceNumber.ControlSource = "ReferenceNumber"
Me.ItemAmount.ControlSource = "ItemAmount"
Me.txtDate.ControlSource = "TranDate"
Me.AccountNumber.ControlSource = "AccountNumber"
Me.VendorID.ControlSource = "VendorID"
Me.Payee.ControlSource = "Payee"
Me.Child78.SourceObject = "Query.JGAS_Transactions_Query"
Else
Me.RecordSource = "Cannon_Transactions_Query"
Me.txtID.ControlSource = "ID"
Me.ReferenceNumber.ControlSource = "ReferenceNumber"
Me.ItemAmount.ControlSource = "ItemAmount"
Me.txtDate.ControlSource = "Date"
Me.AccountNumber.ControlSource = "AccountNumber"
Me.VendorID.ControlSource = "VendorID"
Me.Payee.ControlSource = "Payee"
Me.Child78.SourceObject = "Query.Checks-Cannon"
End If
End If
dbs.Close
Set rs = Nothing
End Sub