|
-
Jul 28th, 2000, 02:39 PM
#1
Thread Starter
Hyperactive Member
Sorry to have to post this on two boards, but I need help ASAP.
Okay, here's the situation: I am using ADODC and Access 2000, and I need a certain field to be required only when a boolean value is true. I can't change the attributes of the table on the fly because it is a multi-user program. I have tried things such as
Code:
Private Sub Adodc1_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
If Me.Visible = False Or MyBoolean = False Then Exit Sub
If adReason = adRsnUpdate And dbcGroup = "" Then
MsgBox "Must enter a group."
dbcGroup.SetFocus
adStatus = adStatusCancel
End If
End Sub
and I have tried putting similar code in the other events. All has been to no avail because everything gives me an error somewhere.
-
Jul 28th, 2000, 05:17 PM
#2
Hyperactive Member
What's wrong with a bit of old fashioned front end validation. Persumably the user presses an 'OK' button to save the record at which point you check the boolean value and if it is true and the field is blank message the user and exit the sub before the save.
if myBool = true and text1 = "" then
msgbox "You have left a required field blank"
exit sub
end if
'Save stuff goes here and can't be reached until above
'condition is satisfied
-
Jul 28th, 2000, 07:17 PM
#3
Thread Starter
Hyperactive Member
Hi Bigley! Actually no, I don't have a save button. In
the last version of the program where we used DAO, we had
save buttons on all of the forms. this time around I am
using ADO and am trying like it is in access, where the
record is automatically saved when you move the recordset
for whatever reason. It is less work for the user and
works fine except for in this stupid little problem that I
have here.
Okay that's it, I am dead beat and giving up for the day.
But MAN would it be nice to solve this tomorrow and not
have to sweat over it any more.
[Edited by DrewDog_21 on 07-28-2000 at 08:19 PM]
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
|