If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > A form change its record set based on switchboard selection

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-22-09, 16:40
BottledFury BottledFury is offline
Registered User
 
Join Date: Nov 2009
Posts: 32
A form change its record set based on switchboard selection

So i want to have a switchboard with like 5 different buttons... each assosiated with a query or table... and I want the form it opens to change its recordset based on what was selected... so that the dropdowns on the forms have different data depending on what was selected...

Im rambling... but I think its possible, probably needs some VB code of some kind but im not sure where to start... anyone know how to do this or a good web site that talkes about it?

Thank!

BottledFury
Reply With Quote
  #2 (permalink)  
Old 11-23-09, 02:00
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
so design your queries/forms/reports/table and so on
then open your switchboard in design mode
then add the fucntions you want.
you can do this also by editing the data directly. you need to do a bit of investigation to find out what the various commands and values mean but it can be done.
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 11-23-09, 03:01
Jim Wright Jim Wright is offline
Registered User
 
Join Date: Oct 2004
Location: Melbourne, Australia
Posts: 201
Switchboards are handled slightly differently from normal forms. There is a Database Utility (see Database Window Menu) called Switchboard Manager where you can nominate what happens when a button is pressed. For what you need, I suggest selecting the option to run a VBA function which modifies your settings then opens the form.
If you want to change the data shown in the form, then each variant should have a query associated with it. Then, when you press a button on the switchboard, the VBA function will open the form and assign the appropriate query to the RecordSource property. If, on the other hand, you are looking to change the selectable items in various combo boxes and list boxes, the technique is much the same. You create SQL queries as strings in VBA and assign them to the RowSource in the appropriate controls.
Reply With Quote
  #4 (permalink)  
Old 11-23-09, 16:25
BottledFury BottledFury is offline
Registered User
 
Join Date: Nov 2009
Posts: 32
Lightbulb Perhaps a silly Mistake

Yes yes very good... I have been trying to do this

I have a statement attached to switchboard option

DoCmd.OpenForm NameOfForm, acNormal, qryNameHere

When i run it it the compiler throws up on me and says

Run-Time Errror 2494
The action or method requires a Form Name argument
??
Reply With Quote
  #5 (permalink)  
Old 11-23-09, 16:34
BottledFury BottledFury is offline
Registered User
 
Join Date: Nov 2009
Posts: 32
Duh

Had to put FormName in " "

lol
Reply With Quote
Reply

Tags
recordset, switchboard

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 On
Pingbacks are On
Refbacks are On