|
-
Feb 5th, 2025, 05:24 AM
#1
Thread Starter
Member
Cancel in ValidateEdit event of vsFlexGrid causes beep
My library program (Visual Basic 6.0) consists mainly of a vsFlexGrid with multiple columns for Title, Author, Borrowed Date, Return Date. I want to edit the Return Date in situ by making the cell editable, then typing a modified date.
Consider the following code snippet:
' NB: CurrentBorrowedDate is in another column in the grid
With flx
NewValue = .EditText
Case .ColIndex("ReturnDate")
If IsDate(NewValue) Then
If CDate(NewValue) >= CDate(CurrentBorrowedDate) Then
' Update the database
rsLoanHistory("LH_ReturnDate") = NewValue
rsLoanHistory.Update
Else
MsgBox "Return Date cannot be before Borrowed Date"
Cancel = True ' <------- Problem arises here
End If
Else
MsgBox "Invalid date format"
End If
End With
It works fine, BUT ! The use of Cancel = True when the new date is wrong or invalid causes a loud system beep and there is no way I've found to suppress it.
Has anyone got an answer for this annoyance?
Edit note: Having submitted this, I see that the indenting has been lost! But the code is still okay.
Tags for this Thread
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
|