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

Validation rules for controls

P: 5
Hi everybody,

I have an access database for a socio economic survey. I am entering the data through forms. Some form have questions which are interrelated.
eg: Do you have land phone connection? No/yes
if yes, what is the phone number?

The first one is a combo box and the second is a text box. In such context, I want to disable the second textbox in case of "No". Any suggestion on how to do this?

Also there is a primary key "house no" in every form. some forms have sub forms also with house no. Can i pass the house no in the main form to the sub form?

Thanks in advance for the help

Sumith.
Sep 10 '07 #1
Share this Question
Share on Google+
3 Replies


puppydogbuddy
Expert 100+
P: 1,923
Hi everybody,

I have an access database for a socio economic survey. I am entering the data through forms. Some form have questions which are interrelated.
eg: Do you have land phone connection? No/yes
if yes, what is the phone number?

The first one is a combo box and the second is a text box. In such context, I want to disable the second textbox in case of "No". Any suggestion on how to do this?

Also there is a primary key "house no" in every form. some forms have sub forms also with house no. Can i pass the house no in the main form to the sub form?

Thanks in advance for the help

Sumith.
1. Any suggestion on how to do this?

use the following code in the afterupdate event of your combobox. Replace the field and object names I used with the actual names of those objects in your application.

Private Sub YourCombo_AfterUpdate()
If Me!YourCombo.Value = "No" Then
Me!YourTxtbox.Enabled = False
End If
End Sub

2. Can i pass the house no in the main form to the sub form?

Yes, the best way is to use the master/child links built into access for a main form and subform.
Sep 10 '07 #2

P: 5
Thanks for the help. The enabling of controls works very nicely. But I can't get the subform linking. As I said earlier, the subform is in a one to many relation with the main form. Main form displays the "house no" which I want to be displayed in the subform "house no' field (just to make sure both the house nos are same for the data entry operator) and to store it in both the main form and subform tables. Couldn't find the master child links also. Maybe I didn't look properly. Any suggestions?

Thanks in advance,

Sumith.
Sep 11 '07 #3

puppydogbuddy
Expert 100+
P: 1,923
Thanks for the help. The enabling of controls works very nicely. But I can't get the subform linking. As I said earlier, the subform is in a one to many relation with the main form. Main form displays the "house no" which I want to be displayed in the subform "house no' field (just to make sure both the house nos are same for the data entry operator) and to store it in both the main form and subform tables. Couldn't find the master child links also. Maybe I didn't look properly. Any suggestions?

Thanks in advance,

Sumith.
Yes. to get to the subform click on the border between your main form and the subform you want to link. That border holds the subform control. Invoke the property sheet while the border is clicked and you will see the name, source object, master link and child link properties.

The name is the name of the subform control. The source object is the name of the form inside the subform control that is commonly referred to as the subform. The master and child links are the fields (in your case HouseNo) that will be used to link the main form(master) to subform (child).

If you still having trouble locating the subform control, I suggest you look at the tutorial entitled "Data fields on forms and reports" at the following link:

http://www.functionx.com/access/
Sep 11 '07 #4

Post your reply

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