How to refer to a specific field record in a subform?

All,

I have inserted a continuous subform in a form.
The subform is a query and is used to view all records from the query and also enter information through certain fields in the query back down to the related table.

The problem is when I try to disable certain subform field records depending on corresponding subform field records, the whole field gets disabled.
In the following piece of code when I update a record in the 'Ignored' field and its answer is 'Yes', then I want to disable the corresponding record in the 'Reference' field.
The code I used behind the subform was

Private Sub .......
    If Ignored.Value = "Yes" Then
       Reference.Enabled = False
    Else
        Reference.Enabled = True
    End If
End Sub

This code disabled the whole 'Reference' field instead of just a specific record in the field.

I think the code I am trying to run would look something like the following;

Private Sub .......
    Dim RecNum As Integer
    RecNum = Me.CurrentRecord
   
    If Ignored.Value(RecNum) = "Yes" Then
       Reference.Enabled(RecNum) = False
    Else
        Reference.Enabled(RecNum) = True
    End If
End Sub

I would appreciate your help,
Thanks,
aobrien32
LVL 4
Alan OBrienSystems AdministratorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aflockhartCommented:
THe control is enabled ( for all records) or disabled (for all records).

You don't say where you have your existing code: you might need it to run in a couple of different cases:

1 - when changing value of Ignored
2 - when moving to a new record


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Alan OBrienSystems AdministratorAuthor Commented:
I'm not sure if you fully understood what I meant by the above question.

Basically I want to be able to refer to a specific field of a record  for example

on a dataset subform i select(place the cursor in) column 3 row 4. i.e the 4th record of a field
what is the correct syntax in VBA to say the value of the selected field
 for  example i thought it would be      

fieldname(4).value

but this does not compile.



0
BrentTempleCommented:
On a continuous form, I don't know of any way to specify the row.   There is one 'active' row and when you refer to the fieldnames, you always are referring to the active row.  

If you move your cursor to the 4th row, and any VBA Code runs, it will always run against the 4th row (until you move your cursor to another row).  By putting your cursor there, you've made that row the 'active' row.   In code on your subform, you can say me.fieldname.value.

Hope that helps.
-Brent
0
BrentTempleCommented:
Sorry, I re-read my comment and this is unclear:
"On a continuous form, I don't know of any way to specify the row."
Should read:
"On a continuous form, I don't know of any way to specify the row in VBA Code."
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.