By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,960 Members | 1,453 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,960 IT Pros & Developers. It's quick & easy.

Validate another control based on selection.

repath
P: 14
Dear All:

Issue: I used a tab control with 3 tabs, named personal details, academic record, Extra curricular activities (ECA):

Each tab has respective controls like option buttons with in a frame, check boxes, text boxes, list box and others.
Like wise for the rest of other tabs. I have placed another control CheckBox (3 in number - each one for one tab)
Reason being: When I click UPDATE command button, respective tables should be updated based on the check box value. ie., if only personal details check box has a value then the details are updaed only to personal details table, if personal details and ECA check box has a value then only personal details and ECA tables will be updated, like wise for rest of the other selections. Therefore database updation is based on automatic CheckBox selections.

Problem: I want to write code so that if atleast one of the controls has data, the respective check box should be selected automatically and if none of the controls has data, the check box should be without check (value) reason being, if there are new entrants, they donot have academic record and extracurricular activies, but only to the existing students.

I prefer writing code in the following manner:

dim ctrl as control
for each ctrl in me.controls
.....
......
......
next

You can suggest me any other method if the problem is addressed. Please consider listbox, check box, frame with option buttons, text box as controls in the respective tabs.

Any help will be appreciated.

With regards
Repath Athyala.
Jul 4 '10 #1

✓ answered by nico5038

Dear Repath,

The easy way wold be to have linked subforms bound to the tables and thus the user can insert/update the individual records as usual.
I guess however that you work with "unbound" controls. In such a case I would advise to disable the [Update] button when no change has been made and in the AfterUpdate event of the fieldcontrols enable the [Update] button.

Your wanted loop can be used than for filling the Update/Insert queries.

Idea ?

Nic;o)

Share this Question
Share on Google+
2 Replies


nico5038
Expert 2.5K+
P: 3,072
Dear Repath,

The easy way wold be to have linked subforms bound to the tables and thus the user can insert/update the individual records as usual.
I guess however that you work with "unbound" controls. In such a case I would advise to disable the [Update] button when no change has been made and in the AfterUpdate event of the fieldcontrols enable the [Update] button.

Your wanted loop can be used than for filling the Update/Insert queries.

Idea ?

Nic;o)
Jul 5 '10 #2

NeoPa
Expert Mod 15k+
P: 31,769
I too, infer from your question you are not using bound controls. It is possible to work this way, but it is not how Access was designed to work. Access does much for you if you let it. Trying to work around Access instead of with it is likely to make your work so much harder.

That said, Nico's idea to use bound subforms instead, is a good one, and uses Access how it's designed to be used. I would certainly recommend following his advice on this.
Jul 5 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.