Click, Double Click and Run Time Error 2115 Revisited

  • Thread starter Thread starter David Wetmore
  • Start date Start date
D

David Wetmore

Apparently I did not make myself clear in my first posting.

The code DOES WORK if the two top procedures are called by a double click event on the combo box

The code DOES NOT WORK if the two top procedures are called by a single click event on the combo box.

The help for error 2115 says the problem lies in the before update event code or the validation rule. There is no
additional help on this error.
 
David
did you try Marsh's suggestion about .Text
and change the line
txtBanner.Text = strBannerText 'Run-time error 2115
to
txtBanner = strBannerText

Private Sub BannerUpdate(txtBanner As TextBox, strBannerText As String)
'Keep the banner boxes read-only
txtBanner.SetFocus
txtBanner.Locked = False
*txtBanner.Text = strBannerText 'Run-time error 2115*
txtBanner.Locked = True
End Sub 'BannerUpdate

Jeanette Cunningham
 
David, not sure why you are declaring textbox controls as textbox, I never
need to do this, it adds extra complication to reading your code.

Private Sub BannerUpdate(txtBanner As TextBox, strBannerText As String)
'Keep the banner boxes read-only
txtBanner.SetFocus
txtBanner.Locked = False
txtBanner.Text = strBannerText 'Run-time error 2115
txtBanner.Locked = True
End Sub 'BannerUpdate

I would replace the above code with the following simpler version:
Private Sub BannerUpdate(strBannerText As String)
Me.txtBanner = strBannerText
End Sub 'BannerUpdate

A question, about the variable strBannerText. Is this a module level
variable?
From where will the sub BannerUpdate be able to read the value for
strBannerText?
In fact the more I look at this, the more confusing it seems.
How does Call BannerUpdate(txtQuadBanner, strQuadBanner).
relate to
Private Sub BannerUpdate(txtBanner As TextBox, strBannerText As String)?

I can see that Private Sub MakeLinkRecord changes the value of
strBannerText, but how does this value get passed to strQuadBanner to be
used in Call BannerUpdate(txtQuadBanner, strQuadBanner).
Is there a module level variable or textbox that holds the value of
strBannerText?

Jeanette Cunningham
 
Back
Top