473,405 Members | 2,261 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,405 software developers and data experts.

Can a listbox be used to pop up a form based on selection?

imrosie
222 100+
Hellol,

I'm again in need of your help with my Order processing system..

My Order form is based on (query) of Customer and Order tables (includes a subform for the product data)...has a listbox (values are check or credit card)...to store the payment type. What I'm looking for is a way to pop up a form based off either a credit card or a check selection. Either form would then store their data into the Payments table (used for report processing) i.e, paymentID, cardholder's name, exp date, last 4 digits of card, routing number, etc.........

I would actually like to have a textbox (for storing the check number/routing number)....Possibly have it be not active until the check selection is made in the listbox; then for a credit card selection, a small form to popup for additional information.

Help, does anyone understand what I'm trying to do and better yet, if someone has done this, could you point me to a sample form (similar)??? thanks so much, in advance.

Rosie
Aug 2 '07 #1
7 3362
ADezii
8,834 Expert 8TB
Hellol,

I'm again in need of your help with my Order processing system..

My Order form is based on (query) of Customer and Order tables (includes a subform for the product data)...has a listbox (values are check or credit card)...to store the payment type. What I'm looking for is a way to pop up a form based off either a credit card or a check selection. Either form would then store their data into the Payments table (used for report processing) i.e, paymentID, cardholder's name, exp date, last 4 digits of card, routing number, etc.........

I would actually like to have a textbox (for storing the check number/routing number)....Possibly have it be not active until the check selection is made in the listbox; then for a credit card selection, a small form to popup for additional information.

Help, does anyone understand what I'm trying to do and better yet, if someone has done this, could you point me to a sample form (similar)??? thanks so much, in advance.

Rosie
Hello Rosie!
Is your request to open 2 different Forms based on whether the selection in a List Box is either Check or Credit Card? If this is not the case, please provide additional information, if it is, please provide the Name of the List Box as well as the Names of the Forms and I'll get back to you.
Aug 7 '07 #2
imrosie
222 100+
Hello Rosie!
Is your request to open 2 different Forms based on whether the selection in a List Box is either Check or Credit Card? If this is not the case, please provide additional information, if it is, please provide the Name of the List Box as well as the Names of the Forms and I'll get back to you.
Hi ADezii,

Yes, you got it. They're two different forms gathering different info (but each will store into the Payments table). The listbox is called 'paymnt'.

I'm thinking of putting this behind a cmd button...
Expand|Select|Wrap|Line Numbers
  1. If Me.MyListBox.Value = 1 Then
  2.  DoCmd.OpenForm "Form1"
  3. Else
  4.  DoCmd.OpenForm "Form2"
  5. End If
  6.  
Do you have any suggestions better than this? thanks

Rosie
Aug 7 '07 #3
ADezii
8,834 Expert 8TB
Hi ADezii,

Yes, you got it. They're two different forms gathering different info (but each will store into the Payments table). The listbox is called 'paymnt'.

I'm thinking of putting this behind a cmd button...
Expand|Select|Wrap|Line Numbers
  1. If Me.MyListBox.Value = 1 Then
  2.  DoCmd.OpenForm "Form1"
  3. Else
  4.  DoCmd.OpenForm "Form2"
  5. End If
  6.  
Do you have any suggestions better than this? thanks

Rosie
Place either 1 of the following code blocks in the AfterDate() Event of the List Box. Which block you use depends on whether the List Box contains 1 or 2 Columns:
Expand|Select|Wrap|Line Numbers
  1. Private Sub paymnt_AfterUpdate()
  2. 'For a Single Column List Box
  3. Select Case Me![paymnt]
  4.   Case "Check"
  5.     DoCmd.OpenForm "Form1"
  6.   Case "Credit Card"
  7.     DoCmd.OpenForm "Form2"
  8.   Case Else
  9. End Select
  10.  
  11. 'For a 2 Column List Box (1st Key Column hidden)
  12. Select Case Me![paymnt].Column(1)
  13.   Case "Check"
  14.     DoCmd.OpenForm "Form1"
  15.   Case "Credit Card"
  16.     DoCmd.OpenForm "Form2"
  17.   Case Else
  18. End Select
  19. End Sub
  20.  
Aug 7 '07 #4
imrosie
222 100+
Place either 1 of the following code blocks in the AfterDate() Event of the List Box. Which block you use depends on whether the List Box contains 1 or 2 Columns:
Expand|Select|Wrap|Line Numbers
  1. Private Sub paymnt_AfterUpdate()
  2. 'For a Single Column List Box
  3. Select Case Me![paymnt]
  4.   Case "Check"
  5.     DoCmd.OpenForm "Form1"
  6.   Case "Credit Card"
  7.     DoCmd.OpenForm "Form2"
  8.   Case Else
  9. End Select
  10.  
  11. 'For a 2 Column List Box (1st Key Column hidden)
  12. Select Case Me![paymnt].Column(1)
  13.   Case "Check"
  14.     DoCmd.OpenForm "Form1"
  15.   Case "Credit Card"
  16.     DoCmd.OpenForm "Form2"
  17.   Case Else
  18. End Select
  19. End Sub
  20.  
Thanks so much ADezii,

My listbox has only 1 column. So I'll use the first one..

thanks again,
Rosie
Aug 8 '07 #5
ADezii
8,834 Expert 8TB
Thanks so much ADezii,

My listbox has only 1 column. So I'll use the first one..

thanks again,
Rosie
Anytime, Rosie. we're always here to help if needed.
Aug 8 '07 #6
imrosie
222 100+
Anytime, Rosie. we're always here to help if needed.
ADezii,

The compiler(runtime error) its complaining about the dot{.} or exclamation, or parenthesis in the first line of the Select statement.

Expand|Select|Wrap|Line Numbers
  1. Select Case Me![paymnt]
I've tried the following:

1.) "Select Case Me.paymnt
2.) "Select Case Me.[paymnt]
any ideas?

Rosie
Aug 8 '07 #7
ADezii
8,834 Expert 8TB
ADezii,

The compiler(runtime error) its complaining about the dot{.} or exclamation, or parenthesis in the first line of the Select statement.

Expand|Select|Wrap|Line Numbers
  1. Select Case Me![paymnt]
I've tried the following:

1.) "Select Case Me.paymnt
2.) "Select Case Me.[paymnt]
any ideas?

Rosie
  1. The code as listed in Post #5 is correct:
    Expand|Select|Wrap|Line Numbers
    1. Select Case Me![paymnt]
    2.   Case "Check"
    3.     DoCmd.OpenForm "Form1"
    4.   Case "Credit Card"
    5.     DoCmd.OpenForm "Form2"
    6.   Case Else
    7. End Select
    8.  
  2. Are you executing the code in the AfterUpdate() Event of paymnt?
  3. Is paymnt the correct Name for the List Box?
Aug 8 '07 #8

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

Similar topics

2
by: James Goodman | last post by:
I have a listbox named sub1 on an asp page. I need to fill this list with values from a table. These are selected based upon the selection of a value/s in another listbox. It was suggested that I...
3
by: Andrew | last post by:
I'm having a major problem with a databound listbox in C#. In the constructor for the form I am trying to pre-select some of the items based in information in the database. When I step through the...
6
by: Alpha | last post by:
I have a listbox with datasource from a dataview. When a user selects a different item in a combobox then I need to refresh the listbox to the appropriate listing based on that combobox's selected...
6
by: Chris Leuty | last post by:
I am populating a multiselect Listbox from a dataset, with the content of the listbox filled by one table, and the selections determined from another table. So far, I have been keeping the dataset...
0
by: The Zakman | last post by:
Please help me with a listbox and postback issue that has me baffled. I am storing my database connection strings in my web.config. At page_load, the db strings that are currently stored in the...
9
by: zdrakec | last post by:
Hello all: Clearly, I'm not getting it! Here is the scenario: On a web page, I have two list boxen and a text box. The first listbox is populated at page load time (if it is not a postback)....
5
by: Randy | last post by:
Hi, I'm have a form with a listbox and a few textboxes on it. Based on the user's selection in the listbox, I want the bindingsource to update the textboxes with the corresponding values. I have...
8
by: NJonge01 | last post by:
Great thanks to all the helpful responses I've read! Recently using MS Access after a lengthy (7-10 years) away from the tool. I apologize for posting a question that for all intents & purposes...
3
by: deejayquai | last post by:
Hello Simple one this I guess, but I'm quite stuck at the moment. I would like to update the records displayed in my listbox (lstStudents) using criteria selected from my combo (cboForm) in a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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.