|
-
Apr 1st, 2006, 01:27 AM
#1
Thread Starter
Member
[RESOLVED] VB6 LostFocus
Hi all,
I'm putting together a front-end for an Access '97 db using VB6.
I'm using the LostFocus event to save data to the db. The trouble is, when the cursor is in a text box, and the user clicks a menu item, it looks like the LostFocus event is not firing properly. Specifically, the data saving procedures are not working, because it seems the recordset is no longer available.
Is there any way to finish the LostFocus before going on to the menu command? I've tried DoEvents in the menu_click event, that doesn't seem to help.
thanks, Peter
VB Code:
Public Sub txtTest_LostFocus(Index As Integer)
DoEvents
' Two lots of text boxes, one for 'testwhat' and one (not visible)
' for 'IDTest', to identify the current record
' Trim txtTest(Index), to trim, and to get rid of spaces
' in an otherwise empty box
Trim (txtTest(Index).Text)
' If no text in the box, Delete
' If text in the box, Edit-Update
If txtTest(Index).Text = "" Then
rstTests.FindFirst "IDTest = " & txtTestID(Index).Text
txtTestID(Index).Text = ""
rstTests.Delete
Else
rstTests.FindFirst "IDTest = " & txtTestID(Index).Text
rstTests.Edit
rstTests!testwhat = txtTest(Index).Text
rstTests.Update
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|