473,883 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Check box controls subform control source formula

I have a subform for listing parts. It has fields including: ClaimID, ITEM,

NET PRICE, LIST PRICE, Quantity, Supplier, and a calculated field called Part
Total. The subform is based on a query. The Part Total field is calculated
as (=[tblParts].[NET PRICE]*[tblPartPerClaim].[Quantity]). Then there is a
hidden text box on my subform that calculates the sum of all the Part Totals
for each claim. There is another field on my main form set equal to this
field on the subform.

My question is: Can I have a check box on my main form that, if checked,
would apply a formula to use the LIST PRICE in the calculation instead of the
NET PRICE?

I tried using the IIF function in place of the above formula, but it would
only return #Name? What's wrong? The IIF function I used is as follows:

PartTotal=Quant ity * (IIF(Parent.chk CaseExtended=Ch ecked,[LIST PRICE],[NET PRICE]))

I also tried:

PartTotal=Quant ity * (IIF(frmClaim.c hkCaseExtended= Checked,[LIST PRICE],
[NET PRICE]))

frmClaim is my main form.
chkCaseExtended is my check box.
I appreciate any help.

Thanks,

Shannan
--
Message posted via http://www.accessmonster.com
Nov 13 '05 #1
3 4584
Shannan,
I got a little confused trying to visualize the exact nature of your
setup. I hope that I understood the problem enough to at least point
you in the right direction.

Access evaluates checkboxes as either true(-1 or non 0) or false (0).
You should say Parent.chkCaseE xtended=-1. I imagine the form thinks
'Ch*ecked' in Parent.chkCaseE xtended=Ch*ecke d is a control - hence
the #name error.

Try:
PartTotal=Quant ity * IIF(frmClaim.ch kCaseExtended=-1,[LIST PRICE],
[NET PRICE])
or
PartTotal=Quant ity * IIF(frmClaim.ch kCaseExtended,[LIST PRICE],
[NET PRICE])
On the second example the =-1 is removed because in a conditional
statement, access will implicitly evaluate the value of a control as
true or false. The only thing to watch out for is to make sure that
chkCaseExtended is never null. you can do that by
PartTotal=Quant ity * IIF(nz(frmClaim .chkCaseExtende d,0),[LIST PRICE],
[NET PRICE])
HTH
Pachydermitis

Nov 13 '05 #2
Pachydermitis,

This at least returns something, but when I load my form it asks for the
Parameter Value ("frmClaim.chkC aseExtended), and if I don't enter anything,
it just uses [NET PRICE]. It's like the check box has no effect.

Thanks for the help, though,

Shannan

Pachydermitis wrote:
Shannan,
I got a little confused trying to visualize the exact nature of your
setup. I hope that I understood the problem enough to at least point
you in the right direction.

Access evaluates checkboxes as either true(-1 or non 0) or false (0).
You should say Parent.chkCaseE xtended=-1. I imagine the form thinks
'Ch*ecked' in Parent.chkCaseE xtended=Ch*ecke d is a control - hence
the #name error.

Try:
PartTotal=Quan tity * IIF(frmClaim.ch kCaseExtended=-1,[LIST PRICE],
[NET PRICE])
or
PartTotal=Quan tity * IIF(frmClaim.ch kCaseExtended,[LIST PRICE],
[NET PRICE])
On the second example the =-1 is removed because in a conditional
statement, access will implicitly evaluate the value of a control as
true or false. The only thing to watch out for is to make sure that
chkCaseExtende d is never null. you can do that by
PartTotal=Quan tity * IIF(nz(frmClaim .chkCaseExtende d,0),[LIST PRICE],
[NET PRICE])
HTH
Pachydermiti s

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #3
I also tried making the PartTotal text box on the subform an unbound text box
and going to my main form and setting the After Update event of the check box
to...

Private Sub chkCaseExtended _AfterUpdate()
If chkCaseExtended = -1 Then
[subParts].[Form]![PartTotal] = ([tblPartPerClaim].[Quantity]*[tblParts].[LIST PRICE]
Else
[subParts].[Form]![PartTotal] = ([tblPartPerClaim].[Quantity]*[tblParts]
..[NET PRICE]
End If

End Sub
When I checked the check box it kept giving me an object required error, and
it left the PartTotal field in the subform blank on the form load.

Shannan Casteel wrote:
Pachydermiti s,

This at least returns something, but when I load my form it asks for the
Parameter Value ("frmClaim.chkC aseExtended), and if I don't enter anything,
it just uses [NET PRICE]. It's like the check box has no effect.

Thanks for the help, though,

Shannan
Shannan,
I got a little confused trying to visualize the exact nature of your

[quoted text clipped - 20 lines]
HTH
Pachydermit is

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #4

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

Similar topics

0
2364
by: Joseph J. Egan | last post by:
I am extending an existing Access/VBA app and need to update a subform displayed in continuous view within a containing form. The existing form and subform have worked fine to date with the subform's RecordSource set to an underlying DB table. To extend the existing app, I need to add controls to the subform and set their Text values etcetera at runtime. (Clearly if a single RecordSource would do the trick, I would extend the...
5
5415
by: jdph40 | last post by:
Is there any way to do this on a form in Access 97? If the value of a combo box is .5, I want two check boxes to be visible (labels are a.m and p.m.). If the value of the combo box is 1, I want the two check boxes to be invisible. Thanks, JD
15
24904
by: Rey | last post by:
Howdy all. Appreciate your help with several problems I'm having: I'm trying to determine if the Visit subform (subformVisits) has a new record or been changed, i.e. dirty. The form that contains the subform is named Clients. I have this code in the Add Client btn: If Forms!Clients.subformVisits!VisitDirty = True Then MsgBox "Visit subform is dirty!"
2
4100
by: neptune | last post by:
I built a form to access a query with a 2 field primary key. It should use 2 controls to find the unique record and display the other field values on the form. In the criteria section of the query, I set the 2 primary key values equal to the 2 control values on my form. When I input a value to these 2 controls the query finds the correct record, so I know my query with the criteria works. My problem is trying to get the output values...
0
1256
by: Shannan Casteel via AccessMonster.com | last post by:
I have a subform for listing parts. It has fields including: ClaimID, ITEM, NET PRICE, LIST PRICE, Quantity, Supplier, and a calculated field called Part Total. The subform is based on a query. The Part Total field is calculated as (=.*.). Then there is a hidden text box on my subform that calculates the sum of all the Part Totals for each claim. There is another field on my main form set equal to this field on the subform. My...
2
1718
by: Shannan Casteel via AccessMonster.com | last post by:
I have a subform for listing parts. It has fields including: ClaimID, ITEM, NET PRICE, LIST PRICE, Quantity, Supplier, and a calculated field called Part Total. The subform is based on a query. The Part Total field is calculated as (=.*.). Then there is a hidden text box on my subform that calculates the sum of all the Part Totals for each claim. There is another field on my main form set equal to this field on the subform. My...
2
1918
by: Shannan Casteel via AccessMonster.com | last post by:
I have a simple invoice form with a subform that allows the user to list part numbers along with the quantity. The subform has a calculated field called that should take either the or the and multiply by to get a value. The subform is based on a query that pulls from 2 tables. (tblPartPerClaim & tblParts) I've tried using the IIF function in the field of the query, the field of the subform, and I've also tried leaving the text...
2
1941
by: Anthony England | last post by:
I wonder if anyone would have 5 minutes to check this for me. Access XP with new database created: Simple table tblTest: ID=autonumber, F1=Text with a few sample records frmSub has this as its recordsource and is set to datasheet view frmMain is unbound and has a subform control named 'sbfSub1' with 'frmSub' as the source object which is placed in the form footer. It has a button on the detail section with the following code: MsgBox...
3
2762
by: google | last post by:
I'm developing an application for use within my company in Access 2003. I'm new to '03, the application I did for my former employer was in '97. The two applications have similar functionality (we're sales offices, and I'm doing things such as associate directories, commission calculations, order tracking, etc.). 2003 seems to have a few extra features, but I seem to continually run in to oddities that seem like they SHOULD work, but...
0
11142
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
10743
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
10847
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
9574
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
7971
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
7129
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
5797
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...
0
5991
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3233
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.