Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changed Form

Status
Not open for further replies.

tiggrr

Programmer
Jun 23, 2006
7
US
I'm trying to capture changes to a form. It works except when the 'Del' key is used.

Code:
Private Sub txtAddress_KeyPress(KeyAscii As Integer)
    Call FormChange
End Sub

Public Sub FormChange(ByRef bFormChange As Boolean)
    Dim obj As Object
    For Each obj In frmSStab
        If TypeOf obj Is TextBox Then
            If obj.DataChanged Then
                bFormChange = True
            End If
        End If
    Next obj
End Sub

Any ideas would be helpful.

Thank you.
 
Key down will respond to keys; esc, ctl, alt, windows thingy, caps lock. Can't use it. thanx anyway.
 
Private Sub txtAddress_KeyPress(KeyAscii As Integer)
if not KeyAscii = {Look up the ascii values you want to eliminate}
Call FormChange
End Sub

Or

Private Sub txtAddress_KeyPress(KeyAscii As Integer)
if KeyAscii = {Look up the ascii values you want to trap} or keyAsci = {ascii value} or etc etc
Call FormChange
End Sub

I would use

Select case Keyascii

Case {ascii value}, {asciivaue2} etc
Call FormChange

Or not.

I do not have MSDN on this laptop so cannot give you the Ascii values. Just look them up.

There are many other options as well. Just depends on what you want to do.

But tis is how you can capture the keystroke

 
You have:

Public Sub FormChange

that accepts one parameter: bFormChange As Boolean

But when you call this Sub, you do not provide anything that this Sub needs, which is a Boolean. This does not work.

Also, your bFormChang is very local to your Sub, and you do assign the value to it. So what? You can not use it anywhere else since its scope is just local.

Am I missing something here?
Or is that just a short version of what you try to do?

--- Andy
 
The sub should have read:
Code:
Private Sub txtAddress_KeyPress(KeyAscii As Integer)
    Call FormChange(bFormChange)    
End Sub

It works only not the way it was first presented here.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top