enable/disable combo box on continuous form (1 Viewer)

Nisha16

New member
Local time
Today, 15:11
Joined
Nov 27, 2018
Messages
6
Hi All,

I am trying to enable/disable a combo box values in a continuous form in access vba using condition formatting.

What i want here is to disable saved records and combo box for new records should be enabled.

Any sort of help would be great.
 

isladogs

MVP / VIP
Local time
Today, 10:41
Joined
Jan 14, 2017
Messages
18,216
This may work depending on whether you have a bound or unbound combo.
In the CF wizard, create a rule with Field Value not equal to "" and then click the small box to the right of the font colour dropdown.
If it doesn't work, use vba instead. Just put similar code in the form current event

Welcome to AWF as well.
 
Last edited:

Galaxiom

Super Moderator
Staff member
Local time
Today, 19:41
Joined
Jan 20, 2009
Messages
12,852
If there is the potential for any field to be empty you could include a field in the RecordSource query that updates as the record is saved. Base the ConditionalFormatting on that field.

There is no need to display the field in a control on the form.
 

Nisha16

New member
Local time
Today, 15:11
Joined
Nov 27, 2018
Messages
6
Hi isladogs, I have tried your solution but its not working as expected.

As soon as I am selecting new value for the combo box, its also getting disabled. Which i only want to get disabled once i exit the form and the record is getting saved in the database.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 19:41
Joined
Jan 20, 2009
Messages
12,852
Use ConditionalFormatting with an Expression Is condition type.

In the expression, refer to a field that is written when the record is saved such as the ID. This is blank until the record is saved.
 

Nisha16

New member
Local time
Today, 15:11
Joined
Nov 27, 2018
Messages
6
Hi Galaxiom, Thanks for your reply.

For the combo box my record source is a query. And this is in subform.
This a single combo box which turns into multiple rows if the user wants to select more than one value for a single application.

When the user has opened the form and selecting a option for the combo box and moving to next row and selecting again different option for the next row and then exiting the form.

When next time the same user opens the form, he should see those 2 selected values as disabled and from the third row the combo box should be enabled to select a new value from the dropdown and once he selects a value , it should not get disabled that time itself.
 

Nisha16

New member
Local time
Today, 15:11
Joined
Nov 27, 2018
Messages
6
Hi All,

can anyone please help on the below query.

TIA.
 

isladogs

MVP / VIP
Local time
Today, 10:41
Joined
Jan 14, 2017
Messages
18,216
Suggest you post your database with additional explanation
 

Nisha16

New member
Local time
Today, 15:11
Joined
Nov 27, 2018
Messages
6
Hi isladogs,

I am doing some modification on a front end vba application - access 2003.

if on the main form one check box is checked then a dropdown should appear to select values for the user which is in subform (continuos form).

What i want here is that if i select a value from the drop down and exit the form, the next time when i re-open the form for the same application the selected value for the drop down should be disabled/greyd out. Whatever values i select for the combo box should only be greyd out once i exit the form not at the time of selection.

TIA. If you could help me here.
 

June7

AWF VIP
Local time
Today, 01:41
Joined
Mar 9, 2014
Messages
5,470
Can't 'disable' individual items in a combobox. The combobox is either enabled or it isn't.

Are you saying if a value has been selected into a record it should not be available for another record? Need to apply filter to exclude those used values. One possible approach:

SELECT field FROM tableB WHERE field NOT IN (SELECT field FROM tableA);

Then might need some code to save record and requery the combobox as you navigate and edit records.
 

Nisha16

New member
Local time
Today, 15:11
Joined
Nov 27, 2018
Messages
6
Hi june7,

what you are saying is already been done and working fine.

There is only a single combo box, containing some values to be selected.

One user can select many values from the combo box, only thing is when the user exits the form and again re-open, the selected values of the combo box should be greyd out or disabled. And again if the user wants to select some values for the combo box, they should not be greyd out as soon as the user selects them. Hope i am clear here. Thanks.
 

June7

AWF VIP
Local time
Today, 01:41
Joined
Mar 9, 2014
Messages
5,470
Nope, don't understand any better. If what I describe is 'working fine' then why do you have a question?

Is this a multi-select combobox bound to a multi-value field. I NEVER use multi-value field.

Better provide db as requested. Follow instructions at bottom of my post. Be sure to identify form with the issue.
 

isladogs

MVP / VIP
Local time
Today, 10:41
Joined
Jan 14, 2017
Messages
18,216
One user can select many values from the combo box, only thing is when the user exits the form and again re-open, the selected values of the combo box should be greyd out or disabled. And again if the user wants to select some values for the combo box, they should not be greyd out as soon as the user selects them. Hope i am clear here. Thanks.

That was just as clear the first time ... as was the answer.
It can't be done. Combos are either enabled or disabled - all or nothing.

If you are using a multi valued combo, the rules are a bit different but the above is still true
MVFs are generally considered a bad idea & will cause you lots of problems if you continue using them
For an explanation, see this article on my website http://www.mendipdatasystems.co.uk/multivalued-fields/4594468763

For non multivalued fields, what you could do is modify the row source after each selection is made to remove that from the list and continue if appropriate till all have been selected.

However. an easier way of doing that would be to use a multiselect listbox so you can see what has been selected each time. However on reopening the form, by default the listy would be cleared so you would need to add code to recall previous selections and re-select them

Either way, it needs a fair bit of code.
The fact that this is not available as a standard feature is that it doesn't fit 'standard' database use.
It may be that your design requirements need modifying.

Good luck with finding the best solution for your needs
 

Users who are viewing this thread

Top Bottom