473,666 Members | 2,258 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.c om
http://www.accessmonster.com/Uwe/For...ccess/200606/1
Jun 1 '06 #1
3 1994
Melon via AccessMonster.c om 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(Date Joined),"Pendin g",_
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(Date Joined),"Pendin g",_
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.c om wrote:
Hi Salad, Thanks for taking a look, Seems to be just what I need.
Status : IIF(IsNull(Date Joined),"Pendin g",_
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","No t Equal")
If you click on View/SQL from the menu you'll see something like
IIF(1 = 2,"Equal","No t 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
5379
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
9684
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 master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
5
3070
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 to achieve a value. I want this done in phpMyAdmin 2.7, if possible, so that when I change the values in other fields, the Points variable changes, due to its equation. The equation I would want would be something like: "won * 3 + drawn * 1"...
15
3837
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* populate the variable, but the population is not *required* by the derived class (which must be the case). What would meet the requirements is if I create an abstract method in the base class that populates the member variable. In this case the...
1
1506
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 has a list box that pulls a full list of medicines from a table. In the table I have two columns Medicine Name and Show When. I only show Medicine Name in the list box on the form. On the form I also have a text box (named Medicine), that is populated...
9
3849
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 "task_id" and the label of "task_name". In the second form field, I would like the default value to be determined by the selection made in the first field. Based on the selection of the first form field, I would like the default value of the...
5
8084
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 incremented number would help to reduce errors and make data entry simpler. The next record in the Test_SrNo field should not have any entry in it until the text insertion point enters the Test_SrNo field. Example: If the last test serial number...
10
2364
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 code. Public Function fCalcEquation(strEquation As String) As Long Dim MyDB As DAO.Database Dim rstParameters As DAO.Recordset Dim intParamPosition As Integer Dim strParameter As String Dim strValue As String
11
2289
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 error message created. However, if the date field is not populated, then Field 2 need not be populated. is this possible?
0
8443
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8866
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8550
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.