Click, Double Click and Run Time Error 2115 Revisited

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.
 
J

Jeanette Cunningham

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
 
J

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Click, Double-Click and Run Time Error 2115 2
Run-Time Error 2115 2
error 2115 1
Run-time error '2115' 3
Run-Time Error 2115 1
Run-time error '2115' 1
Combo Box On Click 6
Error 2115 and Listbox 3

Top