Enable / Disable fields only in the current record

GregP

Registered User.
Local time
Tomorrow, 00:45
Joined
Sep 16, 2002
Messages
66
I have a tabular form, meaning multiple records are on the screen simultaneously. When I click a checkbox, I want the associated fields in the current record only to be enabled / disabled, but all my coding efforts seem to enable / disable every instance of those fields in every record.

Sideline question, what does the me. property do? Trying bits of code on this site don't seem to make a difference whether me. is there or not.

I can do the disabling / enabling OK, it's just restricting it to the current record I'm stuck on.

Any help much appreciated.
 
If you are in the newer version(s) try looking into "Conditional formatting" Not sure if it will enable/disable tho....

Older version(s) (like 97) no go sorry

Regards
 
No, using Access2k, but conditional formatting only appears to affect the appearance. VBA seems to be the way to do it, and as I said I can make all instances of certain fields enabled or disabled, but I only want to effect this in the current record.
 
Greg,

You are only going to be able to modify the "current" record
anyway. Use the OnCurrent event to enable/disable.

The Me. is VBA's way in the code section to reference the
collection of objects within the form domain. In the code
window, when you type Me. you will be presented with
a drop-down list of all objects that you can reference.

Wayne
 
Wayne, not in a continues form... unless i am mistaken...

You are effecting the current form. But effects are visible on "all" forms... (rows)

Regards
 
mailman,

Visually, the effect is the same for all records on the form,
but the logic (and actual enable/disable) can only be in
effect for the current record. You can only "be" on the
current record. That's why its the current record.

Wayne
 
I think mailman has presented the issue I'm faced with, and I think you've answered it Wayne. Yes I know I can only type in the current record, but I'll explain exactly the situation.

I have a datasheet form, chosen because it allows the user to view multiple records on one screen. In each record, I have an 'Allocated' field, which, when checked, should enable a number of associated fields, *but* I only want this to happen in the current record. At the moment, when I check the 'Allocated' checkbox, the associated fields are enabled, but this happens in every record, including records which have the 'Allocated' checkbox unchecked. This is slightly confusing for the operator, because 1) it implies that the other instances of the field should also have data entered, and 2) allows them to enter data in fields which should be locked and thus prevent data entry.

Does this fuller description describe more clearly what I'm wanting to achieve? Is there any way around this?
 
1) it implies that the other instances of the field should also have data entered, and 2) allows them to enter data in fields which should be locked and thus prevent data entry.

1) Can't do anything about the implication
2) No it doesn't. It just looks like it. Only a single row can be current at any given time. So, if your enable/disable code is in the Current event, it will be executed if the user attempts to place his cursor into a column of a different row.
 
Thanks guys, there do appear to be a few bandaids available, but not really the full thing I was looking for. That's OK, it's no major drama, it does work as is, but I'm a rookie at VBA and thought there may be condition I didn't know of which would do exactly what I was after. Thanks for your help!
 
I have done this sort of thing by calling the macro (that makes a certain control visible based on an entry in another control) from the OnCurrent of the form and the OnClick from the control that the condition is set on, or your "Allocated" check box.

If I understand you correctly you want those controls to be availble when the check box is clicked AND when you move to another record you want it to change based on that record.

The available/unavailable controls begin with the Visible property set to no, then the macro resets the Visible to no, then resets it again to Yes based on what was entered into that specific field.

I have 3 macros, one that resets to Invisible, one that resets to Visible, and the last that calls both of those in that order and this is the one that is used in the OnCurrent and OnClick.

So as you enter the current record it changes AND it will also change in a new record when you click Allocated.

I realize it sounds crazy to make it change to invisible then visible but that was the only way I could make it work.

This may not work for you because I am using it on a single form, but its an option to look into and I hope this wasn't too confusing!! :)
 

Users who are viewing this thread

Back
Top Bottom