Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 17th, 2007, 04:07 AM
Registered User
 
Join Date: Mar 2007
Location: Fresno, CA, .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Combo Box dependent transferred to another form

Hi,

I have a situation in developing an access form, that I need to display the values from a record as the selected values in the dependent combo boxes. This I could do on the web with ASP code but this is my first time building an access form as according to the higher powers I cannot host anything on the web, so I have to create a vb - access frontend that can be shared on a network drive.

I would really appreciate any help.

Thanks,
Ebaad.
Reply With Quote
  #2 (permalink)  
Old May 17th, 2007, 12:50 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Hi, this is pretty common.

Create a module and declare some public variables. Since these are combo boxes, I am going to assume they are bound to PKs, so the public variable should be integers.

Public pCombo1, pCombo2, pCombo3 As Integer

Now these are available throughout your VBA without declaration.

When you move from the first form with your selections to your second form with combo boxes (already made up and displaying meaningful fields) then do this on the first form's button's on click event:

pCombo1 = Me.SelectedField
pCombo2 = Me.NextSelectedField

etc, or where ever they are coming from. If they are not integer values, then you will need to modify the code accordingly.

Then on the On Load or On Open event of the second form, put this code:

Me.Combo1 = pCombo1
Me.Combo2 = pCombo2
etc

Of course, on the first form you will want to make sure that each filed has a value to pass, otherwise substitute another value.

Does this get you started?

mmcdonal
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo box to display items from parent combo box Gini Visual Studio 2008 0 June 18th, 2008 12:30 AM
Combo box choice creating filtered combo box stevensj5 Access 11 September 13th, 2007 11:33 AM
Form and Combo Box Leave Trails on Screen Coby Excel VBA 4 August 4th, 2007 01:54 AM
Retain form value from dependent list box qhong Dreamweaver (all versions) 18 November 4th, 2004 03:36 AM
Drop Down/Combo box/List in a Form from DB mazimi Classic ASP Basics 2 October 1st, 2004 10:43 AM



All times are GMT -4. The time now is 06:05 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.