update checkbox based on value in another checkbox (1 Viewer)

lscheer

Registered User.
Local time
Today, 05:43
Joined
Jan 20, 2000
Messages
185
I'm trying to use the following code to update a checkbox value (Course Catalog) based on several other checkbox values on the same form. I am getting the error: Object or With Block not defined.

Any suggestions, as I'm not much of a coder, yet...?

Dim chkCourseCatalog As Boolean
Dim chkAQApplicant As Boolean
Dim chkBlacklisted As CheckBox
Dim chkNativeVoices As CheckBox

chkCourseCatalog = Me!CourseCatalog
chkAQApplicant = Me!AIAQTPApplicant
chkNativeVoices = Me!NativeVoices
chkBlacklisted = Me!chkBlacklisted

If chkAQApplicant = -1 Then
chkCourseCatalog = -1
End If

If Me!StillInField = "No" Or chkBlacklisted = -1 Then
chkCourseCatalog = 0
chkNativeVoices = 0
End If
 

Drevlin

Data Demon
Local time
Today, 05:43
Joined
Jul 16, 2002
Messages
135
There is no need for your four variables (as far as I can tell).

The following code works just as well:

If Me.AIAQTPApplicant = -1 Then
Me.CourseCatalog = -1
End If

If Me.StillInField = "No" Or Me.chkBlacklisted = -1 Then
Me.CourseCatalog = 0
Me.NativeVoices = 0
End If

Generally it is unnecessary to pass a checkbox to a variable especially when you want to affect a change in the checkbox itself.


Peace
 

lscheer

Registered User.
Local time
Today, 05:43
Joined
Jan 20, 2000
Messages
185
Thanks! Works great!
 

Users who are viewing this thread

Top Bottom