473,396 Members | 2,002 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,396 software developers and data experts.

Field populated from derived equation. Help?

If anyone could take a look at this, I could do with the help.

Im running into 2 problems with my db.

1) I have a members section in my db. If a member is selected as senior, all
fields apply to him, if a member is selected as junior, other fields don't
apply and I need to be able to hide them.
2) I have a date joined field, there is an expiry date field, which is date
joined + 365. On the form, I have a combo box looking up a table which stores
the values Active/Pending/Expired. If the expiry date is <365 I need it to
automatically show Active, If the expiry is > I need it to automatically show
Expired.

I realise this is a simple enough situation, but I can't seem to figure it
out. If anyone has a chance could they offer advice? Thanks all...

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200606/1
Jun 1 '06 #1
3 1983
Melon via AccessMonster.com wrote:
If anyone could take a look at this, I could do with the help.

Im running into 2 problems with my db.

1) I have a members section in my db. If a member is selected as senior, all
fields apply to him, if a member is selected as junior, other fields don't
apply and I need to be able to hide them.
In your property sheet for a form, under Other, there's a row called
TAG. In it, you could put some sort of flag. Ex:
Sub SetCtl()
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If ctl.Tag > "" Then
ctl.Visible = (ctl.Tag = "Senior" And MemberType = "S")
End If
End If
Next
End Sub

Let's say MemberType is "J" or "S". If you leave all Tag fields that
need to be displayed for both j/s blank, they'll display. Put the word
Senior in the tag field for those that need to be visible/hidden.

You can call this in the OnCurrent event and the AfterUpdate event of
the field that sets the j/s status.


2) I have a date joined field, there is an expiry date field, which is date
joined + 365. On the form, I have a combo box looking up a table which stores
the values Active/Pending/Expired. If the expiry date is <365 I need it to
automatically show Active, If the expiry is > I need it to automatically show
Expired.
I suppose DateJoined is null if Pending. In the query, create a column
like this:
Status : IIF(IsNull(DateJoined),"Pending",_
IIF(DateJoined + 365 > date(),"Active",Expired"))

This will create a column called status. If joined is null it is
pending. If the expired date is greater than today, active else inactive.

I realise this is a simple enough situation, but I can't seem to figure it
out. If anyone has a chance could they offer advice? Thanks all...

Jun 1 '06 #2
Hi Salad, Thanks for taking a look, Seems to be just what I need.

Status : IIF(IsNull(DateJoined),"Pending",_
IIF(DateJoined + 365 > date(),"Active",Expired"))


Not very experienced in Access... Are you suggesting that I base my 'Status'
field on a query? Can you elaborate a little more for me? Still very new to
all this,.... :(

--
Message posted via http://www.accessmonster.com
Jun 1 '06 #3
Melon via AccessMonster.com wrote:
Hi Salad, Thanks for taking a look, Seems to be just what I need.
Status : IIF(IsNull(DateJoined),"Pending",_
IIF(DateJoined + 365 > date(),"Active",Expired"))

Not very experienced in Access... Are you suggesting that I base my 'Status'
field on a query? Can you elaborate a little more for me? Still very new to
all this,.... :(

When you create a query in the query builder you can create a calculated
field. It is 2 parts; column name separated by a colon then the
formula. Ex:
Test: IIF(1 = 2,"Equal","Not Equal")
If you click on View/SQL from the menu you'll see something like
IIF(1 = 2,"Equal","Not Equal") As Test, ...
in the SQL statement. You now have a column called Test along with the
rest of the columns. Create a query and use the example line I just
gave to get a feel for creating a calc'd column.
Jun 1 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Apple | last post by:
Can I edit an calculated field in my form if needed. Thank you in advance for your help. Sincerely Apple
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
5
w33nie
by: w33nie | last post by:
My table is pretty well complete, but I would prefer it if the value for Points could be turned into a mathematical equation, and this equation would use the data from the other fields in the table...
15
by: Bob Johnson | last post by:
I have a base class that must have a member variable populated by, and only by, derived classes. It appears that if I declare the variable as "internal protected" then the base class *can*...
1
by: datasec23 | last post by:
Hi... I really appreciate your help with my question, I am pulling my hair out on this. I have not been able to find an answer on the other posts. I am using Access 2000. I have a form that...
9
by: Brett_A | last post by:
I have a form where the first field is a dynamic drop-down that pulls from a db (Access). The fields associated with the query are task_id, task_name and task_rate. The field has the value of...
5
by: David Wright | last post by:
Hello Everyone I would be grateful if someone could help me with the automatic increment of a field on my subform called ‘Test_SrNo’. I am Using Microsoft Office 2000. The auto entry of the...
10
by: Constantine AI | last post by:
Hi i am having a little problem with an equation function that was created from all your help previously. The function works fine itself but with a small glitch within it. Here is the function...
11
by: tfurubay | last post by:
Hi, I am building a form and i would like it to have conditional error messages. For instance, I am creating a Date field. If the date field is populated, I also need Field 2 populated and an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.