After a user selects a series of Combo boxes a final combo box may or may NOT be populated depending on the data set
The following code is my attempt to do the following when a command button is clicked:
If the list is not populated then set the control
cbo_TestNumber to 1
If the list is populated then find the DMax "TestNumber" from the list, increment by 1 and set this value to cbo_TestNumber.
'Select Test Number Automatically
Dim ListControl As Control
Dim count As Long
Set ListControl = Me.cbo_TestNumber
With ListControl
If .ListCount = 0 Then
Me.cbo_TestNumber = 1
Else
'Can't get this to work using column property
count = DMax"TestNumber", "data_GroupData", " [TestNumber] = Forms![frm_TestInput]![cbo_TestNumber].Column(1)")
'
'works fine using a query
count = DMax("TestNumber", "qry_MaxTestNum")
End If
count = count + 1
Me.cbo_TestNumber = count
Me.Refresh
Debug.Print count
End With
Using a query I can get this to work fine but I would like to use the column property and can't seem to get this run
The following code is my attempt to do the following when a command button is clicked:
If the list is not populated then set the control
cbo_TestNumber to 1
If the list is populated then find the DMax "TestNumber" from the list, increment by 1 and set this value to cbo_TestNumber.
'Select Test Number Automatically
Dim ListControl As Control
Dim count As Long
Set ListControl = Me.cbo_TestNumber
With ListControl
If .ListCount = 0 Then
Me.cbo_TestNumber = 1
Else
'Can't get this to work using column property
count = DMax"TestNumber", "data_GroupData", " [TestNumber] = Forms![frm_TestInput]![cbo_TestNumber].Column(1)")
'
'works fine using a query
count = DMax("TestNumber", "qry_MaxTestNum")
End If
count = count + 1
Me.cbo_TestNumber = count
Me.Refresh
Debug.Print count
End With
Using a query I can get this to work fine but I would like to use the column property and can't seem to get this run