473,659 Members | 2,526 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Comparing Calculated fields on seperate forms

78 New Member
I have two forms [fsubinputvoltag e] and [fsubelectronic] that have unbound calculated fields. Thes are both subforms to [frmHeaderMaster]. The field on [fsubinputvoltag e] is [calcAvailPower] and field for [fsubelectronic] is [calcOutputPower]. On [calcOutputPower] being dirty or updated I need a message box if [calcOutputPower] is greater than [calcAvailPower]. Can someone help?
Jun 22 '07 #1
13 1727
BradHodge
166 Recognized Expert New Member
I believe that you would just need to use an AfterUpdate Event similar to this...

Expand|Select|Wrap|Line Numbers
  1. Private Sub calcOutputPower_AfterUpdate() 
  2.     If calcOutputPower > Forms![frmHeaderMaster]![fsubinputvoltage].Form![calcAvailPower] Then
  3.     MsgBox ("It's Greater!")
  4.     End If
  5. End Sub
Good Luck,
Brad.
Jun 22 '07 #2
alphaomega3
78 New Member
I believe that you would just need to use an AfterUpdate Event similar to this...

Expand|Select|Wrap|Line Numbers
  1. Private Sub calcOutputPower_AfterUpdate() 
  2.     If calcOutputPower > Forms![frmHeaderMaster]![fsubinputvoltage].Form![calcAvailPower] Then
  3.     MsgBox ("It's Greater!")
  4.     End If
  5. End Sub
Good Luck,
Brad.
Getting #Name?.... Figured out this has something to do with my formula used to calculate the calcOutputPower .....will get back to you when I get this figured out.

AO3
Jun 22 '07 #3
alphaomega3
78 New Member
Got other problem fixed.. Okay I have it semi working. It will work if I place a Command button and click on it using the following code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command31_Click()
  2.     If Me.txtOutputPOwer.Value > Forms![frmHeaderMaster]![fsubInputVoltage].Form![calcAvailPower] Then
  3.     MsgBox ("It's Greater!")
  4.     End If
  5.  
  6. End Sub
However, if I use the following code... Nothing happens....

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtOutputPOwer_AfterUpdate()
  2.     If Me.txtOutputPOwer.Value > Forms![frmHeaderMaster]![fsubInputVoltage].Form![calcAvailPower] Then
  3.     MsgBox ("It's Greater!")
  4.     End If
  5. End Sub
This is a subform on a tabcontrol.
Jun 22 '07 #4
BradHodge
166 Recognized Expert New Member
You got me. Since you had it on a tab control, I placed mine on a tab control and tried it again in an AfterUpdate event without changing the code at all. Worked like a charm.

Oh well... as long as it's working I guess :)
Jun 22 '07 #5
alphaomega3
78 New Member
no, I need to figure out why it isn't working.... Management is pretty intent on it working after update...
Jun 22 '07 #6
BradHodge
166 Recognized Expert New Member
What version of Access are you using?
Jun 22 '07 #7
alphaomega3
78 New Member
Access 2003 but saving in 2000 format. Also this is written as an Access project....if that makes any difference.
Jun 22 '07 #8
BradHodge
166 Recognized Expert New Member
Can you post your code for frmHeaderMaster , and the 2 subforms?
Jun 22 '07 #9
alphaomega3
78 New Member
yep

frmHeaderMaster

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2.  
  3. Private Sub Command43_Click()
  4. On Error GoTo Err_Command43_Click
  5.  
  6.     Dim stDocName As String
  7.  
  8.     stDocName = "Application Inquiry Form"
  9.     DoCmd.SendObject acReport, stDocName, "SnapshotFormat(*.snp)", _
  10.   "DELETED", "", "", "This is a test.", "", False, ""
  11.  
  12.  
  13. Exit_Command43_Click:
  14.     Exit Sub
  15.  
  16. Err_Command43_Click:
  17.     MsgBox Err.Description
  18.     Resume Exit_Command43_Click
  19.  
  20. End Sub
  21. Private Sub Command45_Click()
  22. On Error GoTo Err_Command45_Click
  23.  
  24.  
  25.     DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
  26.  
  27. Exit_Command45_Click:
  28.     Exit Sub
  29.  
  30. Err_Command45_Click:
  31.     MsgBox Err.Description
  32.     Resume Exit_Command45_Click
  33.  
  34. End Sub
  35. Private Sub Command46_Click()
  36. On Error GoTo Err_Command46_Click
  37.  
  38.  
  39.     DoCmd.GoToRecord , , acNewRec
  40.  
  41. Exit_Command46_Click:
  42.     Exit Sub
  43.  
  44. Err_Command46_Click:
  45.     MsgBox Err.Description
  46.     Resume Exit_Command46_Click
  47.  
  48. End Sub
  49. Private Sub Command47_Click()
  50. On Error GoTo Err_Command47_Click
  51.  
  52.     Dim stDocName As String
  53.  
  54.     stDocName = "Application Inquiry Form"
  55.     DoCmd.OpenReport stDocName, acPreview, "", "[CrNo]=[Forms]![frmHeaderMaster]![CrNo]"
  56.  
  57. Exit_Command47_Click:
  58.     Exit Sub
  59.  
  60. Err_Command47_Click:
  61.     MsgBox Err.Description
  62.     Resume Exit_Command47_Click
  63.  
  64. End Sub
fsubelectronic
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Private Sub Command31_Click()
  3.     If Me.txtOutputPOwer.Value > Forms![frmHeaderMaster]![fsubInputVoltage].Form![calcAvailPower] Then
  4.     MsgBox ("It's Greater!")
  5.     End If
  6.  
  7. End Sub
  8.  
  9. Private Sub txtOutputPOwer_AfterUpdate()
  10.     If Me.txtOutputPOwer.Value > Forms![frmHeaderMaster]![fsubInputVoltage].Form![calcAvailPower] Then
  11.     MsgBox ("It's Greater!")
  12.     End If
  13. End Sub
fsubinputvoltag e has no module

txtOutputPOwer
Expand|Select|Wrap|Line Numbers
  1. =IIf([CoUom]="Oz.-In.",([ContRpm]*[ContTorq]/1352), IIf([CoUom]="Lb.-Ft.",([ContRpm]*([ContTorq]*192)/1352), IIf([CoUom]="Nm",([ContRpm]*([ContTorq]*141.6116)/1352), IIf([CoUom]="mNm",([ContRpm]*([ContTorq]*0.1416116)/1352))))) 
calcAvailPower
Expand|Select|Wrap|Line Numbers
  1.  =[BusVolt]*[DrvCurLim]
Jun 22 '07 #10

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

Similar topics

1
2951
by: SJH | last post by:
I have been given an older database and asked to make upgrades and what not. One interesting thing I have come across with the database is that it was at one time set up so one of the tables would hold values that were calcuated using a form. I have looked at the code for all the text boxes on the assocatied forms and have yet to figure out how this was done. There were two values set up this way, one still works and the other one...
1
5387
by: Miguelito Bain | last post by:
hi everybody. i'm trying to find out what you can and can't do with/in calculated fields. any help, pointers, and/or advice would be greatly appreciated. i'm a newbie, but i want to learn, and i've tried a lot before posting. here's my situation. i have a simple form with dates on it. i have an indate and outdate
2
2006
by: Phil Stanton | last post by:
I have a form of club members with a continuous subform on it showing boat details. I hold the boat length and beam (in meters) in a table. On the subform I also calculate and show the imperial equivalent length and beam. You can enter lengths in either the metric box when an AfterUpdate event shows the imperial eqivalent, or converseley you can enter the lenght in feet and inches in the imperial box and on AfterUpdate the metric...
1
2964
by: tconway | last post by:
I have an Access program that displays Customer data into a form and OrderID data into a subform. The totals in the Subform are based on calculated fields, i.e. the Total Amount field Calculates the following: =* The Subform Order fields are pulled from a Query along with each calculated Total. They are displyed in a DataSheet View. This works fine on my developement environment which includes a server set up just as our client has. ...
1
3444
by: DaveA | last post by:
Our incident numbering system is based on the following YEAR 05 MONTH 06 NMBR 1234 looks like 05-06-1234 the counter number is manually reset each month and I would like to make it automatic. I am having trouble with the comparing the old month stored as two digit number as text with the new two digit month found using format(date(),"mm")
2
3610
by: ey.markov | last post by:
Greetings, in A2K VBA, I set the following recordset: Set rsGPValue = dbs.OpenRecordset("SELECT *, DateSerial(Year(),Month()+4,0) FROM tblGPValue AS OurDate, dbOpenSnapshot) and then I try to use this calculated field: If rsGPValue.Fields("OurDate") > {Forms]!!.Value
3
4739
by: kelley.l.turner | last post by:
Hi all, I am very new to MS Access so please bear with me! I have created a simple calculated field in my data entry form, yet when I view my data table or try to generate a report based on this calculated field, no value is posted. How/where do I get my calculated values to also show up in the tables and reports? Thanks, Kelley
5
5885
by: Henrik | last post by:
The problem is (using MS Access 2003) I am unable to retrieve long strings (255 chars) from calculated fields through a recordset. The data takes the trip in three phases: 1. A custom public function returns a long string. This works. 2. A query has a calculated field based on the custom function above. This works when the query is run directly.
2
5532
by: jcf378 | last post by:
hi all. I have a form which contains a calculated control ("days") that outputs the # of days between two dates (DateDiff command between the fields and ). However, when I click "Filter by Form" in order to search for records based on this form, I would like to be able to enter a value in this "days" control so that I can filter records on the form based on this calculated interval (i.e., i want to search for records specifically where...
0
8428
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
8341
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,...
1
8539
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
8630
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
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
4176
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
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.