I have a table which records receipts. A particular rider may pay by cash, cheque, credit card or money order. They may also pay by any combination of these and may pay with a cheque or credit card from someone else. I have the default details of their preferred payment method stored and automatically displayed as a suggested entry when they pay. However, I have this showing ALL the time ie if they pay by cash this time but their default is to pay by cheque, the form will display their bank details. I would like the choosing of the payment method (cash cheque etc) to automatically show only the appropriate details for that payment method eg if they choose cheque, show the bank details but not the credit card details stored in their master file; if by credit card, hide the bank details; by cash, hide all – any suggestions
TIA
Steve
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Conditional ‘Show’ (2000 sp3)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Conditional ‘Show’ (2000 sp3)
- This topic has 18 replies, 3 voices, and was last updated 21 years, 1 month ago.
AuthorTopicWSstevecox4444
AskWoody LoungerApril 26, 2004 at 1:33 am #404109Viewing 1 reply threadAuthorReplies-
WSjohnhutchison
AskWoody LoungerApril 26, 2004 at 2:53 am #819670I would put a select case statement in the after-update event of the payment method control, that shows or hides the approrpiate controls , by setting their visible property to true or false.
I would also put the same code in the oncurrent event, so that the same thing happens when you look back at old data.
E.g
Select Case me![PaymentMethod]
Case: “Cash”
me![BSB].visible = falseetc
Post back if want more help in writing out the code
-
WSstevecox4444
AskWoody LoungerApril 26, 2004 at 5:47 am #819686Thanks for the suggestion (I think I did the code right but I am very inexperienced in code). One problem that I didn’t explain fully, is that I have the bank account details etc in the master file and these are automatically being entered into the receipt as the default via the .[forms] technique. This technique is great and saves heaps of time/reduces data entry errors when the guy picks his default method of payment. I really need to blank the data for the BSB etc for when a guy who normally pays by cheque and who has his banking details in the master file, decides to pay by another method. When I tried your suggestion (assuming I didnt screw up the code), it changed nothing – understandable given my default values settings
Thanks very much for the quick response
Steve
PS I would be interested in an example of the full code as the technique would be really useful elsewhere and to see if I screwed up -
WSstevecox4444
AskWoody LoungerApril 26, 2004 at 5:47 am #819687Thanks for the suggestion (I think I did the code right but I am very inexperienced in code). One problem that I didn’t explain fully, is that I have the bank account details etc in the master file and these are automatically being entered into the receipt as the default via the .[forms] technique. This technique is great and saves heaps of time/reduces data entry errors when the guy picks his default method of payment. I really need to blank the data for the BSB etc for when a guy who normally pays by cheque and who has his banking details in the master file, decides to pay by another method. When I tried your suggestion (assuming I didnt screw up the code), it changed nothing – understandable given my default values settings
Thanks very much for the quick response
Steve
PS I would be interested in an example of the full code as the technique would be really useful elsewhere and to see if I screwed up -
WSstevecox4444
AskWoody LoungerApril 26, 2004 at 5:50 am #819688Just a later thought- I dont really mind if the data ends up being a bit duplicative (eg has details of both bank account and credit card account even though payt was by credit card this time). Its really just at report stage that it looks messy with cash payments showing a default bank account etc.
Is there an equivalent case approach where I only show fields in the report based on the selection of the payment method
Steve -
WSHansV
AskWoody LoungerApril 26, 2004 at 6:48 am #819718You can put code in the On Format event of the section of the report that contains the payment method and bank account details. For example, if they are on the Detail section. The following is air code, the details depend on your setup. If you would like detailed assistance, you will need to tell us more about the names and types of the fields involved.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Select Case Me.[PaymentMethod]
Case “Cash”
Me.[BankAccountNumber].Visible = False
Me.[CreditCardNumber].Visible = False
Case “Bank”
Me.[BankAccountNumber].Visible = True
Me.[CreditCardNumber].Visible = False
Case “CreditCard”
Me.[BankAccountNumber].Visible = False
Me.[CreditCardNumber].Visible = True
End Select
End Sub -
WSHansV
AskWoody LoungerApril 26, 2004 at 6:48 am #819719You can put code in the On Format event of the section of the report that contains the payment method and bank account details. For example, if they are on the Detail section. The following is air code, the details depend on your setup. If you would like detailed assistance, you will need to tell us more about the names and types of the fields involved.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Select Case Me.[PaymentMethod]
Case “Cash”
Me.[BankAccountNumber].Visible = False
Me.[CreditCardNumber].Visible = False
Case “Bank”
Me.[BankAccountNumber].Visible = True
Me.[CreditCardNumber].Visible = False
Case “CreditCard”
Me.[BankAccountNumber].Visible = False
Me.[CreditCardNumber].Visible = True
End Select
End Sub -
WSjohnhutchison
AskWoody LoungerApril 26, 2004 at 9:43 am #819766 -
WSstevecox4444
AskWoody LoungerApril 26, 2004 at 9:51 pm #820026Wonderful – thank you both very very much – 1 problem and 1 question
The receipts section of the form (BTW the receipts form is a subform to the Costing form) is continuous to allow for split receipts ie payment of a total of $120 via $100 cash and $20 credit card (or any other permutation). When I set the visible properties to false, if I choose say cash, it hides the bank and credit card details beautifully. However it hides it for all the continuous forms so I cannot enter , for example, a cheque payment after a cash payment as the fields are no longer visible. This is the case even if I change the original payment method from, say, cash back to cheque. I can live with the null process if necessary (its much much better than I had) but wondered if there is any solution to the problem above
Question (may be a dumb one). I noticed in Hans’ answer to the code he used Me.[FieldName] but John (if I may be so forward as to use first names) used Me![Fieldname]. As I had already typed the code last night using John’s method, I stuck to that (and it worked). My question is whats the difference between Me. and Me! and when should I use which one
Thanks again
Steve -
WSHansV
AskWoody LoungerApril 26, 2004 at 10:05 pm #820034In a continuous form (my code was meant for a report), there is only one set of controls. If you make a text box invisible, it becomes invisible for all records. You might use conditional formatting instead, since that will work record-by-record.
Strictly speaking, Me![FieldName] refers to a control named FieldName, and Me.[FieldName] to a property of the form named FieldName. In most cases, they are interchangeable.
-
WSstevecox4444
AskWoody LoungerApril 26, 2004 at 10:24 pm #820040Hans thanks for the clarification. My plan is to use the Null process for the receipts form and try the visible process for the resultant report. However have hit a snag
My code is in the On format section of the detail of the report
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Select Case Me.[PaymentMethod]
Case “Cash”
Me.[BankBSB].Visible = False
Me.[BankName].Visible = False
Me.[BankBranch].Visible = False
Me.[BankAcctNo].Visible = False
Me.[BankAccountName].Visible = False
Me.[CreditCardType].Visible = False
Me.[CreditCardName].Visible = False
Me.[CreditcardNo].Visible = False
Me.[ExpiryDate].Visible = False
Case “Cheque”
Me.[CreditCardType].Visible = False
Me.[CreditCardName].Visible = False
Me.[CreditcardNo].Visible = False
Me.[ExpiryDate].Visible = False
Case “Credit Card”
Me.[BankBSB].Visible = False
Me.[BankName].Visible = False
Me.[BankBranch].Visible = False
Me.[BankAcctNo].Visible = False
Me.[BankAccountName].Visible = False
Case “Money Order”
Me.[BankBSB].Visible = False
Me.[BankName].Visible = False
Me.[BankBranch].Visible = False
Me.[BankAcctNo].Visible = False
Me.[BankAccountName].Visible = False
Me.[CreditCardType].Visible = False
Me.[CreditCardName].Visible = False
Me.[CreditcardNo].Visible = False
Me.[ExpiryDate].Visible = False
Case “Direct Deposit”
Me.[CreditCardType].Visible = False
Me.[CreditCardName].Visible = False
Me.[CreditcardNo].Visible = False
Me.[ExpiryDate].Visible = FalseEnd Select
End SubHowever when I run the report, I get Run-Time Error 2427 You Entered an Expression that has no value
debug takes me to “Select Case Me.[PAymentMethod}
Help -
WSHansV
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSstevecox4444
AskWoody LoungerApril 26, 2004 at 10:24 pm #820041Hans thanks for the clarification. My plan is to use the Null process for the receipts form and try the visible process for the resultant report. However have hit a snag
My code is in the On format section of the detail of the report
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Select Case Me.[PaymentMethod]
Case “Cash”
Me.[BankBSB].Visible = False
Me.[BankName].Visible = False
Me.[BankBranch].Visible = False
Me.[BankAcctNo].Visible = False
Me.[BankAccountName].Visible = False
Me.[CreditCardType].Visible = False
Me.[CreditCardName].Visible = False
Me.[CreditcardNo].Visible = False
Me.[ExpiryDate].Visible = False
Case “Cheque”
Me.[CreditCardType].Visible = False
Me.[CreditCardName].Visible = False
Me.[CreditcardNo].Visible = False
Me.[ExpiryDate].Visible = False
Case “Credit Card”
Me.[BankBSB].Visible = False
Me.[BankName].Visible = False
Me.[BankBranch].Visible = False
Me.[BankAcctNo].Visible = False
Me.[BankAccountName].Visible = False
Case “Money Order”
Me.[BankBSB].Visible = False
Me.[BankName].Visible = False
Me.[BankBranch].Visible = False
Me.[BankAcctNo].Visible = False
Me.[BankAccountName].Visible = False
Me.[CreditCardType].Visible = False
Me.[CreditCardName].Visible = False
Me.[CreditcardNo].Visible = False
Me.[ExpiryDate].Visible = False
Case “Direct Deposit”
Me.[CreditCardType].Visible = False
Me.[CreditCardName].Visible = False
Me.[CreditcardNo].Visible = False
Me.[ExpiryDate].Visible = FalseEnd Select
End SubHowever when I run the report, I get Run-Time Error 2427 You Entered an Expression that has no value
debug takes me to “Select Case Me.[PAymentMethod}
Help -
WSHansV
AskWoody LoungerApril 26, 2004 at 10:05 pm #820035In a continuous form (my code was meant for a report), there is only one set of controls. If you make a text box invisible, it becomes invisible for all records. You might use conditional formatting instead, since that will work record-by-record.
Strictly speaking, Me![FieldName] refers to a control named FieldName, and Me.[FieldName] to a property of the form named FieldName. In most cases, they are interchangeable.
-
-
WSstevecox4444
AskWoody LoungerApril 26, 2004 at 9:51 pm #820027Wonderful – thank you both very very much – 1 problem and 1 question
The receipts section of the form (BTW the receipts form is a subform to the Costing form) is continuous to allow for split receipts ie payment of a total of $120 via $100 cash and $20 credit card (or any other permutation). When I set the visible properties to false, if I choose say cash, it hides the bank and credit card details beautifully. However it hides it for all the continuous forms so I cannot enter , for example, a cheque payment after a cash payment as the fields are no longer visible. This is the case even if I change the original payment method from, say, cash back to cheque. I can live with the null process if necessary (its much much better than I had) but wondered if there is any solution to the problem above
Question (may be a dumb one). I noticed in Hans’ answer to the code he used Me.[FieldName] but John (if I may be so forward as to use first names) used Me![Fieldname]. As I had already typed the code last night using John’s method, I stuck to that (and it worked). My question is whats the difference between Me. and Me! and when should I use which one
Thanks again
Steve
-
-
WSjohnhutchison
AskWoody LoungerApril 26, 2004 at 9:43 am #819767
-
-
WSstevecox4444
AskWoody LoungerApril 26, 2004 at 5:50 am #819689Just a later thought- I dont really mind if the data ends up being a bit duplicative (eg has details of both bank account and credit card account even though payt was by credit card this time). Its really just at report stage that it looks messy with cash payments showing a default bank account etc.
Is there an equivalent case approach where I only show fields in the report based on the selection of the payment method
Steve
-
-
WSjohnhutchison
AskWoody LoungerApril 26, 2004 at 2:53 am #819671I would put a select case statement in the after-update event of the payment method control, that shows or hides the approrpiate controls , by setting their visible property to true or false.
I would also put the same code in the oncurrent event, so that the same thing happens when you look back at old data.
E.g
Select Case me![PaymentMethod]
Case: “Cash”
me![BSB].visible = falseetc
Post back if want more help in writing out the code
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
1 hour, 25 minutes ago -
X Suspends Encrypted DMs
by
Alex5723
3 hours, 37 minutes ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
3 hours, 55 minutes ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
4 hours, 32 minutes ago -
OpenAI model sabotages shutdown code
by
Cybertooth
5 hours, 9 minutes ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
27 minutes ago -
Enabling Secureboot
by
ITguy
18 minutes ago -
Windows hosting exposes additional bugs
by
Susan Bradley
13 hours, 3 minutes ago -
No more rounded corners??
by
CWBillow
8 hours, 51 minutes ago -
Android 15 and IPV6
by
Win7and10
44 minutes ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
1 day, 1 hour ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
1 day, 4 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
22 hours, 40 minutes ago -
Windows Update orchestration platform to update all software
by
Alex5723
1 day, 11 hours ago -
May preview updates
by
Susan Bradley
22 hours, 48 minutes ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
14 hours, 23 minutes ago -
Just got this pop-up page while browsing
by
Alex5723
1 day, 3 hours ago -
KB5058379 / KB 5061768 Failures
by
crown
1 day ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
2 hours, 52 minutes ago -
At last – installation of 24H2
by
Botswana12
2 days, 2 hours ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
13 hours, 59 minutes ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
2 days, 15 hours ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
13 hours, 35 minutes ago -
Limited account permission error related to Windows Update
by
gtd12345
3 days, 4 hours ago -
Another test post
by
gtd12345
3 days, 4 hours ago -
Connect to someone else computer
by
wadeer
2 days, 23 hours ago -
Limit on User names?
by
CWBillow
3 days, 2 hours ago -
Choose the right apps for traveling
by
Peter Deegan
2 days, 16 hours ago -
BitLocker rears its head
by
Susan Bradley
2 days ago -
Who are you? (2025 edition)
by
Will Fastie
1 day, 23 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.