473,408 Members | 1,966 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,408 software developers and data experts.

Microsoft Access

3
Hey all, hopefully someone can guide me in the right direction. So in this table, under Operations there are 5 selections you can select. Whichever option is selected along with the Total, I need it to go to the appropriate field. So far I have tried and did not work:

IIf([Operation]="S1","Total","0")

I attached images to help.

Attached Images
File Type: jpg 2.jpg (13.7 KB, 193 views)
File Type: jpg 111111111111.jpg (19.4 KB, 205 views)
Jan 1 '18 #1
5 1854
twinnyfo
3,653 Expert Mod 2GB
jxdq,

Welcome to Bytes!

Are you working with your table in Datasheet view? In order for such calculations to occur, you need to use a Form.

Hope that hepps!
Jan 2 '18 #2
jxdq
3
Thank you for responding sir! I do have a form.

What do I add inside of design view of "Operations" to make it go to the proper field after being selected and hitting submit?

http://imgur.com/a/fHLqP
Jan 2 '18 #3
twinnyfo
3,653 Expert Mod 2GB
jxdq,

It depends on the names of the controls on your Form, but generically:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cboOperation_AfterUpdate()
  2. On Error GoTo EH
  3.  
  4.     Me.txtS1 = 0
  5.     Me.txtS2 = 0
  6.     Me.txtS3 = 0
  7.  
  8.     Select Case cboOperation
  9.         Case "S1"
  10.             Me.txtS1 = Me.txtTotal
  11.         Case "S2"
  12.             Me.txtS2 = Me.txtTotal
  13.         Case "S3"
  14.             Me.txtS3 = Me.txtTotal
  15.     End Select
  16.  
  17.     Exit Sub
  18. EH:
  19.     MsgBox "There was an Error!"
  20. Exit Sub
  21. End Sub
There is a slight challenge with this particular arrangement, however. By placing the value of Total into S1..S3, you are introducing redundant information into your table, which is generally a no-no. If you were to generate a Report based on the data in your table, you can accomplish the same results through a query. Generally speaking, you should not maintain any calculated values as permanent values in your Table, unless you don't actually save the values from which the total is calculated.

I hope this makes sense.

Let me know if this hepps.
Jan 2 '18 #4
jxdq
3
To take away redundant data, is it possible for me to just remove the Total, have the data multiple andthe total go into whichever field under operation is selected?

https://imgur.com/UXxmXd8

https://imgur.com/a/k4cje

How would you do it?
Jan 2 '18 #5
twinnyfo
3,653 Expert Mod 2GB
jxdq,

I will give my recommendation and then give the theoretical and practical reasons for this. Other mods and experts are free to chime in, but I think I am on pretty solid ground.

First, if the Total field is only going to go into one of your three other fields, I would have a Total field with the amount and an Operations Field, with the type of operation indicated.

Second, the theory. If you have three separate fields for S1, S2 and S3, then, since the data is only ever stored in one of these fields, you now no longer have redundant data, but empty space. Again, not recommended. By keeping the Total field and Operation fields, you now have 1) no redundant data, and 2) no empty space.

Third, the practical. Right now, you only have three operations: S1, S2 and S3, correct? What happens when you add an operation (this also falls into the realm of theory). What if you had 20 types of operations? This would make your table very wide for the different operation types having a separate field -- AND 95% of those fields would be empty all the time. Not to mention that every time you added another operation type, you would have to restructure your data tables. My recommendation precludes all the restructure and allows for future expansion based upon your needs and still adheres to sound DB practices.

Hope this hepps!
Jan 3 '18 #6

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

Similar topics

27
by: Chuck Grimsby | last post by:
(Repost, due to lack of submissions...) The Microsoft Access Product Group (the people who build Microsoft Access) want your help! One of the main things we're working on for the near future...
8
by: Larry__Weiss | last post by:
What kind of licensing is needed to be able to use the Microsoft Access product and distribute the applications? In other words, what version of Microsoft Access does a developer need to buy in...
6
by: Null Reference | last post by:
Anybody here who can explain or point me to a link ? I wish to create a blank MS Access DB file programmatically using C# . Thanks, nfs
17
by: Pam Ammond | last post by:
I need to use Microsoft Access Automation within a Visual Studio 2003 program written in C# for Windows Forms. When a button is clicked in my VS.NET program, I want it to run a Microsoft Access...
4
by: bbdobuddy | last post by:
Hi, How do I open a Microsoft Access 2003 form from Visual Basic.net Thanks in advance bbdobuddy
1
by: somersbar | last post by:
hey, ive been trying to set up a web form in visual basic.net that can access a microsoft access database. i need to use odbc also. i can get it working using a windows form but not a web form....
5
by: somersbar | last post by:
hello all, im trying to connect to a microsoft access database from an ASP.NET web form. i keep getting the following error though: ERROR Could not use '(unknown)'; file already in use....
0
by: bazzer | last post by:
hey, i am using visual basic.net 2003 and have an ASP.NET webform application thats accessing a microsoft access 2003 database. i kept getting the following error when i tried to run it: ERROR ...
0
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
3
by: ipellew | last post by:
Hi; I 'e been developing a little application based on MS Access (I am usually in Informix) and have to say the Web is full of sites that offer little in the way of help. I have to say that...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.