How to reffer a certain field by VBA code

avis

New member
Local time
Today, 12:04
Joined
Aug 20, 2008
Messages
6
Hi All,

I'm looking for the code syntax to reffer to a certain field in a specific record on my continuous form.
I need to enable\disable the field with an IF function but only on the record that matches the condition.
if i'll use:
If ... Then
Me.field.enable = true
Else Me.field.enable=False
it will enable\disable all fields on the form and not only the field in the record that match the condition.

Is there a way to reffer a field on the current record like Me.currentRecord.field...

???
 
In the OnCurrent() event of the form place your condition statement.

Code:
If Control = SomeCondition Then
     'Do this
Else
     'Do the other
End If

-dK
 
Last edited:
dk,

Your solution isn't good.
When i play (checking\unchecking) with the checkbox it's doing the condition only the first time i point the record and it's doing the condition action for the all records!!!
I only need to do the action on the current record and eachtime i check\uncheck the checkbox regardless if it's the first time or not !
 
Oh ... didn't know it was a checkbox ...

On the AfterUpdate() event of the checkbox control ...

Code:
If Me!CheckboxName = True Then
     'Do this if it is checked
Else
     'Do this if it is not checked
End If

-dK
 

Users who are viewing this thread

Back
Top Bottom