Syntax error "="

Verify that it IS the name or index of a control occurring in Me.Controls() collection. If it is NOT a collection member, Me.Controls( Me.anything ) returns a null
As I pointed out if done in the after update
Me.Controls(Me.Selalpha)
is almost guaranteed to return an object in the Controls collection just not very likely to be the one you want and likely not an option.
where
Me.SelAlpha.Controls(Me.Selalpha)
is guaranteed to return one of the options in the option group (assuming you set the value equal to the order of the controls you want)
 
Pretty sure this is a "WHERE" not an "AND"
Code:
Case 1
            strWhere2 = " AND qryIncExp.[Hide] = FALSE"

If not it makes a join that does not make any sense.
Code:
SELECT qryincexp.accountid,
       qryincexp.accountname,
       qryincexp.faccounttypeid,
       tblcombo.data AS Type,
       tblcombo.data AS [Group],
       qryincexp.hide,
       qryincexp.modified
FROM   (qryincexp
        INNER JOIN tblcombo
                ON qryincexp.ftypeid = tblcombo.cmboid)
       INNER JOIN tblcombo AS tblCombo_1
               ON qryincexp.fgroupid = tblCombo_1.cmboid
                  AND qryincexp.[hide] = false
ORDER  BY accountname
 
Click on any letter or number in the form except all accounts in the options at the bottom
Value is the default property of the control and it is always integer, you can simplify your code.


Code:
strStart = Left(Me.Controls("B" & Trim(Int(Me.selAlpha))).Caption, 1)
strEnd = Right(Me.Controls("B" & Trim(Int(Me.selAlpha.Value))).Caption, 1)

to

Code:
strStart = Left(Me.Controls("B" & Me.selAlpha).Caption, 1)
strEnd = Right(Me.Controls("B" & Me.selAlpha).Caption, 1)
 
In your approach it requires you to name your controls with a matching value in the option value. "B21 must have a value of 21". This requires a little bit of work in ensuring you named and valued them correctly.

My original suggestion is short, but requires diligence because the controls value has to match the z-order in the the controls collection. This could be even more difficult to see and get correct.

Unfortunately there are two things you cannot do. You cannot simply loop the controls in the option group and determine which is active or which is selected. The active control is never the option, but always the option group. You cannot check the value of a control inside the option group to see if it is selected. You will get an error "The expression has no value". Although Chat may say you can, you cannot. An option in an option group has "no value" this is not the same as empty or null, that property basically has no meaning.

But you can do this. It is a little simpler in that you only have to ensure each control has a unique value, you do not have to worry about order or worry about the naming convention. Makes it a little simpler to maintain.


Code:
Public Function GetCaption(optGroup As OptionGroup) As String
  Dim ctrl As ToggleButton
  For Each ctrl In optGroup.Controls
    'must have unique values for each option
    If ctrl.OptionValue = optGroup.Value Then
      GetCaption = ctrl.Caption
      Exit Function
    End If
  Next ctrl
End Function
 
thank you, arnelgp. After everyone's replies, I went back and reworked and fixed and finally got it. My problem wasn't what I though and I should have gone over the whole thing before bringing it here. Thank you all! Got me straight!
 
Code:
Pretty sure this is a "WHERE" not an "AND"

Code:
Case 1<br>            strWhere2 = " AND qryIncExp.[Hide] = FALSE"

Oh so right! fixed it.
 

Users who are viewing this thread

Back
Top Bottom