473,761 Members | 2,410 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 4580
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
2350
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
5411
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
24871
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
4092
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
1253
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
1715
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
1916
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
1936
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
2756
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
9353
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
10123
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
9975
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...
0
9788
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...
1
7342
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
6623
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();...
1
3889
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3481
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2765
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.