473,320 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

In my wells' form I have a dropdown...

In my ‘Wells’ Form I have a dropdown on ‘Well purpose’ field with the following entries: Injection, Appraisal, Observation, Production, Wildcat.

I have another dropdown on the ‘prospect’ field with several prospect names which are updated in a separate ‘prospect’ form.

I also have another dropdown on the ‘Discovery’ field with several discovery names which are updated in a separate ‘discovery’ form

I want to be able to LOCK the ‘Prospect’ field on condition that I have selected either: Appraisal, Injection, Observation, or Production from the dropdown on ‘Well purpose’.

The ‘Discovery’ field should remain UNLOCKED.

However, if I select Wildcat, the ‘Prospect’ field MUST Unlock automatically, and the ‘Discovery’ field gets Locked automatically.

I would like this to be the case even when I change the entries in those fields.

I thank you for taking your time to read this.
Jul 25 '13 #1
7 1162
zmbd
5,501 Expert Mod 4TB
You will need to use the after update event in the dropdown for the control for "Purpose"

What I would do, depending on how the control is setup, take the value from the "Purpose" control and then use a Select-Case construct to test for the correct values and then set the other two contol's enabled properties as needed.

In the design of the form, I would set the enabled property for "Prospect" and "Discovery" to default to "false" thus, on load they are locked by default forcing the user to make a selection in the "purpose" control before being able to do anything else with the other two controls.

Please make note that Bytes is neither a code writing nor homework service; however, we'll be more than happy to help you with any code that you currently have in the form.
Jul 25 '13 #2
Rabbit
12,516 Expert Mod 8TB
You will also want to call the code in the on current event.
Jul 25 '13 #3
zmbd
5,501 Expert Mod 4TB
Rabbit, as usual has a point there; however, this partially why I made the statement, "(...) depending on how the control is setup(...)" as I don't know if or how your form "Wells'" is bound to the underlying database.
Jul 25 '13 #4
Thank you both Rabbit and zmbd. kindly note that I am not a guru in writing code. The form "wells" is bound via foreign keys from the "wells" table to the other tables in the database.
I tried using this event procedure below on the 'on update' but when I change or remove values the lock/unlock does not reset:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo157_AfterUpdate()
  2. If IsNull(Me.Combo157.Value) Then
  3. Me.Combo153.Locked = False
  4. Else: Me.Combo153.Locked = True
  5. End If
  6. End Sub
This is where I am stuck.
Jul 26 '13 #5
Rabbit
12,516 Expert Mod 8TB
That's because you haven't tested for any of the conditions you specified earlier.
Jul 26 '13 #6
zmbd
5,501 Expert Mod 4TB
yes exactly,
I would suggest you look at the "select...case" construct as the code is much easier to write.
You will need to understand what value is being returned from the first dropdown (is it the primary key, the text, etc) and then test based upon that.
One way to determine this is to look at the properties and then the control source.... can be a pain, and may be what you'll end up having to do anyway.
Easier is to place a debug.print me.yourcontrolnamehere.value in the after update event, run your form, then press <ctrl><g> to open the immedates window and see what is returned.
Jul 26 '13 #7
Dear ZMBD and Rabbit, Thanx for your time. Your help in this regard is much appreciated. I am still working on this ...glad to know you are helping.
Jul 26 '13 #8

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

Similar topics

3
by: NotGiven | last post by:
I have a web form with several fields. If I copy & paste from a RTF document into a field, the javascript validation and field length are bypassed and cause the form to fail. Any ideas?
2
by: David Pautler | last post by:
I'm creating a web-based authoring tool where one form encompasses several sections for editing. I'd like each section to have its own reset button, so that use of that button affects only that...
3
by: Anonymous | last post by:
Hi all, I have a form people use to enter checking data. One of the fields is calculated based on finding the difference of two input fields on the form. Here are the fields: CheckAmount...
0
by: gary b | last post by:
My forehead is sore from beating it against the wall. Can anyone help? I've started drinking again because of this problem! Setup: ContestantTbl = table ('one' side) HorseTbl = table ...
4
by: steph | last post by:
Hello, I've got a text field in an access form (Microsoft Access 2002, SP3), that the user has to fill out. Now I don't want the user to leave this field (and this record) until he has filled...
0
by: moni | last post by:
Hi, I am trying to use, public class FileNameConverter : StringConverter for creating a dropdown list within my dynamic property grid. Thus I have the methods GetStandardValuesSupported,...
4
by: rempit | last post by:
In 1 form..have 2 "DIV".. "DIV" one is for SEARCH.. "DIV" two is for showing the RESULT from Database of "DIV" one Button.. Everything in one page.. Anyone can help me please..
0
by: hitech | last post by:
in c#, i have added some items to the listbox of form1. now i want to pass these items to dropdown box of form2. in form2, i made the object of form1 named f4. then i wrote this line:-...
12
klarae99
by: klarae99 | last post by:
Hi everyone, I am new to Access 2003 (though my time on scripts has helped alot) and am creating an inventory database. In my original table design I had a field tblTrans.Date which I was advised to...
5
by: jaishu | last post by:
Hi , I am using a form based on a query. The form is locked and the fields are not editable, but when i just tried typing something, the contents on the form didnt change, but when i closed and...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.