N
Nikkiewolf
I have a reference table which stores reference categories and options. I
have built a form that enables the user to view the available options by
category and add new options if necessary.
The user selects from a list of Category labels via a combobox (using a
Select Distinct against the table) and I populate a text box with the
category keyword (select distinct keyword where label = combobox) and a
listbox with category options (select options where label = combobox). I am
using REQUERY so that the textbox and listbox re-populate eachtime the user
chooses a new Category label via the combobox.
If the user wants to add a new category box they click on a button which
opens a new form. I want to pass across the Category keyword and Category
label into the new record on the new form but the value of the textbox is
alway null. I suspect this is due to the REQUERY but cannot fix it. Any
suggestions please? My code is as follows:
***FIRST FORM ***
Private Sub Combo9_AfterUpdate()
' Refresh content of Listbox each time a selection is made.
Me.List7.Requery
Me.reflist.Requery
End Sub
' Button that opens 'Reference update form' at a new record, passing across
' the category and Label selected.
Private Sub add_new_category_option_button_Click()
Dim stDocName As String
Dim stLinkCriteria As String
Dim categoryparm As String
Dim labelparm As String
stDocName = "Reference update form"
categoryparm = Me.reflist
labelparm = Me.Combo9
'Open the Reference update form and pass reference
'field category and label into the new record
DoCmd.OpenForm stDocName, , , , , , labelparm & "$" & categoryparm
End Sub
***SECOND FORM***
Private Sub Form_Load()
Me.[Reference Field] = Me.OpenArgs
If Me.NewRecord Then
Me.[Reference Field] = Split(Me.OpenArgs, "$")(0)
Me.[Reference Field Label] = Split(Me.OpenArgs, "$")(1)
End If
End Sub
have built a form that enables the user to view the available options by
category and add new options if necessary.
The user selects from a list of Category labels via a combobox (using a
Select Distinct against the table) and I populate a text box with the
category keyword (select distinct keyword where label = combobox) and a
listbox with category options (select options where label = combobox). I am
using REQUERY so that the textbox and listbox re-populate eachtime the user
chooses a new Category label via the combobox.
If the user wants to add a new category box they click on a button which
opens a new form. I want to pass across the Category keyword and Category
label into the new record on the new form but the value of the textbox is
alway null. I suspect this is due to the REQUERY but cannot fix it. Any
suggestions please? My code is as follows:
***FIRST FORM ***
Private Sub Combo9_AfterUpdate()
' Refresh content of Listbox each time a selection is made.
Me.List7.Requery
Me.reflist.Requery
End Sub
' Button that opens 'Reference update form' at a new record, passing across
' the category and Label selected.
Private Sub add_new_category_option_button_Click()
Dim stDocName As String
Dim stLinkCriteria As String
Dim categoryparm As String
Dim labelparm As String
stDocName = "Reference update form"
categoryparm = Me.reflist
labelparm = Me.Combo9
'Open the Reference update form and pass reference
'field category and label into the new record
DoCmd.OpenForm stDocName, , , , , , labelparm & "$" & categoryparm
End Sub
***SECOND FORM***
Private Sub Form_Load()
Me.[Reference Field] = Me.OpenArgs
If Me.NewRecord Then
Me.[Reference Field] = Split(Me.OpenArgs, "$")(0)
Me.[Reference Field Label] = Split(Me.OpenArgs, "$")(1)
End If
End Sub