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. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Load combobox based on selection
I am working with a databse that has 22 seperate tables. On my form I have a
combobox that is titled Acts and Regulations. This combobox is populated with data from one table. When one of the options is selected I would like to load a second combobox with the corresponding date eg: when Financial Tracking Regulations is selected I want the second combobox to be populated by the table titled Financial Regulations. Can someone help me with this? Z |
#2
|
|||
|
|||
Load combobox based on selection
See
http://www.pacificdb.com.au/MVP/Code/ComboRS.htm -- Joan Wild Microsoft Access MVP Zoltar54 wrote: I am working with a databse that has 22 seperate tables. On my form I have a combobox that is titled Acts and Regulations. This combobox is populated with data from one table. When one of the options is selected I would like to load a second combobox with the corresponding date eg: when Financial Tracking Regulations is selected I want the second combobox to be populated by the table titled Financial Regulations. Can someone help me with this? Z |
#3
|
|||
|
|||
Load combobox based on selection
In the AfterUpdate of the first combo box, put code to reset the RowSource
for the second combo box. There's an example at http://www.mvps.org/access/forms/frm0028.htm at "The Access Web" or (perhaps a better example) http://office.microsoft.com/en-us/as...730581033.aspx -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Zoltar54" wrote in message ... I am working with a databse that has 22 seperate tables. On my form I have a combobox that is titled Acts and Regulations. This combobox is populated with data from one table. When one of the options is selected I would like to load a second combobox with the corresponding date eg: when Financial Tracking Regulations is selected I want the second combobox to be populated by the table titled Financial Regulations. Can someone help me with this? Z |
#4
|
|||
|
|||
Load combobox based on selection
Joan,
Thnaks for the tip. I have entered the code (using the names of my objects) and it does not seem to work. Below is the code. Can you provide some further insight? Z Dim ssql As String ssql = "SELECT sectionID, actregID, section, description" & "From tblCAPS WHERE actregID=&me.ActReg" & "ORDER BY section,description" Me.Sect.RowSource = ssql "Joan Wild" wrote: See http://www.pacificdb.com.au/MVP/Code/ComboRS.htm -- Joan Wild Microsoft Access MVP Zoltar54 wrote: I am working with a databse that has 22 seperate tables. On my form I have a combobox that is titled Acts and Regulations. This combobox is populated with data from one table. When one of the options is selected I would like to load a second combobox with the corresponding date eg: when Financial Tracking Regulations is selected I want the second combobox to be populated by the table titled Financial Regulations. Can someone help me with this? Z |
#5
|
|||
|
|||
Load combobox based on selection
ssql = "SELECT sectionID, actregID, section, description From
tblCAPS WHERE actregID= " & me.ActReg & " ORDER BY section,description" You have misplaced '&' and quotes. -- Joan Wild Microsoft Access MVP Zoltar54 wrote: Joan, Thnaks for the tip. I have entered the code (using the names of my objects) and it does not seem to work. Below is the code. Can you provide some further insight? Z Dim ssql As String ssql = "SELECT sectionID, actregID, section, description" & "From tblCAPS WHERE actregID=&me.ActReg" & "ORDER BY section,description" Me.Sect.RowSource = ssql "Joan Wild" wrote: See http://www.pacificdb.com.au/MVP/Code/ComboRS.htm -- Joan Wild Microsoft Access MVP Zoltar54 wrote: I am working with a databse that has 22 seperate tables. On my form I have a combobox that is titled Acts and Regulations. This combobox is populated with data from one table. When one of the options is selected I would like to load a second combobox with the corresponding date eg: when Financial Tracking Regulations is selected I want the second combobox to be populated by the table titled Financial Regulations. Can someone help me with this? Z |
#6
|
|||
|
|||
Load combobox based on selection
Joan,
Thanks once again. The code no longer gives me an error, however it will not load the data in the tbl CAPS. As I am quite new at the VBA and Access world perhaps I am missing something. The item called tblCAPS - this is the taable I want loaded when a particular Item is selected from the first combobox. Does this need to defined (Dim) and if so what do I define it as (recordset, access object etc..) Z "Joan Wild" wrote: ssql = "SELECT sectionID, actregID, section, description From tblCAPS WHERE actregID= " & me.ActReg & " ORDER BY section,description" You have misplaced '&' and quotes. -- Joan Wild Microsoft Access MVP Zoltar54 wrote: Joan, Thnaks for the tip. I have entered the code (using the names of my objects) and it does not seem to work. Below is the code. Can you provide some further insight? Z Dim ssql As String ssql = "SELECT sectionID, actregID, section, description" & "From tblCAPS WHERE actregID=&me.ActReg" & "ORDER BY section,description" Me.Sect.RowSource = ssql "Joan Wild" wrote: See http://www.pacificdb.com.au/MVP/Code/ComboRS.htm -- Joan Wild Microsoft Access MVP Zoltar54 wrote: I am working with a databse that has 22 seperate tables. On my form I have a combobox that is titled Acts and Regulations. This combobox is populated with data from one table. When one of the options is selected I would like to load a second combobox with the corresponding date eg: when Financial Tracking Regulations is selected I want the second combobox to be populated by the table titled Financial Regulations. Can someone help me with this? Z |
#7
|
|||
|
|||
Load combobox based on selection
You've confused me now. Why are you trying to load a table.?
I thought you had a form with a combobox named [Acts and Regulations] and a second named (actually I don't know what it's named but it contains Financial Regulations). You want to make a selection in the Acts and Regulations combobox, that then restricts the list of values to select in the second combobox. Please explain how the tblCAPS comes in to play. -- Joan Wild Microsoft Access MVP Zoltar54 wrote: Joan, Thanks once again. The code no longer gives me an error, however it will not load the data in the tbl CAPS. As I am quite new at the VBA and Access world perhaps I am missing something. The item called tblCAPS - this is the taable I want loaded when a particular Item is selected from the first combobox. Does this need to defined (Dim) and if so what do I define it as (recordset, access object etc..) Z "Joan Wild" wrote: ssql = "SELECT sectionID, actregID, section, description From tblCAPS WHERE actregID= " & me.ActReg & " ORDER BY section,description" You have misplaced '&' and quotes. -- Joan Wild Microsoft Access MVP Zoltar54 wrote: Joan, Thnaks for the tip. I have entered the code (using the names of my objects) and it does not seem to work. Below is the code. Can you provide some further insight? Z Dim ssql As String ssql = "SELECT sectionID, actregID, section, description" & "From tblCAPS WHERE actregID=&me.ActReg" & "ORDER BY section,description" Me.Sect.RowSource = ssql "Joan Wild" wrote: See http://www.pacificdb.com.au/MVP/Code/ComboRS.htm -- Joan Wild Microsoft Access MVP Zoltar54 wrote: I am working with a databse that has 22 seperate tables. On my form I have a combobox that is titled Acts and Regulations. This combobox is populated with data from one table. When one of the options is selected I would like to load a second combobox with the corresponding date eg: when Financial Tracking Regulations is selected I want the second combobox to be populated by the table titled Financial Regulations. Can someone help me with this? Z |
#8
|
|||
|
|||
Load combobox based on selection
I tend to do that.
The items in the Acts and Regulations box are loaded from a single data table. Each item in the list refers to a seperate table. In this case when the item CAPS is selected from the first combobox, I would like to have the records in the table called CAPS to be loaded into the second combobox called "Section". I hope this is a little bit clearer. Z "Joan Wild" wrote: You've confused me now. Why are you trying to load a table.? I thought you had a form with a combobox named [Acts and Regulations] and a second named (actually I don't know what it's named but it contains Financial Regulations). You want to make a selection in the Acts and Regulations combobox, that then restricts the list of values to select in the second combobox. Please explain how the tblCAPS comes in to play. -- Joan Wild Microsoft Access MVP Zoltar54 wrote: Joan, Thanks once again. The code no longer gives me an error, however it will not load the data in the tbl CAPS. As I am quite new at the VBA and Access world perhaps I am missing something. The item called tblCAPS - this is the taable I want loaded when a particular Item is selected from the first combobox. Does this need to defined (Dim) and if so what do I define it as (recordset, access object etc..) Z "Joan Wild" wrote: ssql = "SELECT sectionID, actregID, section, description From tblCAPS WHERE actregID= " & me.ActReg & " ORDER BY section,description" You have misplaced '&' and quotes. -- Joan Wild Microsoft Access MVP Zoltar54 wrote: Joan, Thnaks for the tip. I have entered the code (using the names of my objects) and it does not seem to work. Below is the code. Can you provide some further insight? Z Dim ssql As String ssql = "SELECT sectionID, actregID, section, description" & "From tblCAPS WHERE actregID=&me.ActReg" & "ORDER BY section,description" Me.Sect.RowSource = ssql "Joan Wild" wrote: See http://www.pacificdb.com.au/MVP/Code/ComboRS.htm -- Joan Wild Microsoft Access MVP Zoltar54 wrote: I am working with a databse that has 22 seperate tables. On my form I have a combobox that is titled Acts and Regulations. This combobox is populated with data from one table. When one of the options is selected I would like to load a second combobox with the corresponding date eg: when Financial Tracking Regulations is selected I want the second combobox to be populated by the table titled Financial Regulations. Can someone help me with this? Z |
#9
|
|||
|
|||
Load combobox based on selection
One doesn't 'load a table' into a combobox, exactly.
Keep going. Suppose the second combo box listed all the records in the CAPS table. Then what do you want to do? Also, what happened to the Financial Regulations combobox? -- Joan Wild Microsoft Access MVP Zoltar54 wrote: I tend to do that. The items in the Acts and Regulations box are loaded from a single data table. Each item in the list refers to a seperate table. In this case when the item CAPS is selected from the first combobox, I would like to have the records in the table called CAPS to be loaded into the second combobox called "Section". I hope this is a little bit clearer. Z "Joan Wild" wrote: You've confused me now. Why are you trying to load a table.? I thought you had a form with a combobox named [Acts and Regulations] and a second named (actually I don't know what it's named but it contains Financial Regulations). You want to make a selection in the Acts and Regulations combobox, that then restricts the list of values to select in the second combobox. Please explain how the tblCAPS comes in to play. -- Joan Wild Microsoft Access MVP Zoltar54 wrote: Joan, Thanks once again. The code no longer gives me an error, however it will not load the data in the tbl CAPS. As I am quite new at the VBA and Access world perhaps I am missing something. The item called tblCAPS - this is the taable I want loaded when a particular Item is selected from the first combobox. Does this need to defined (Dim) and if so what do I define it as (recordset, access object etc..) Z "Joan Wild" wrote: ssql = "SELECT sectionID, actregID, section, description From tblCAPS WHERE actregID= " & me.ActReg & " ORDER BY section,description" You have misplaced '&' and quotes. -- Joan Wild Microsoft Access MVP Zoltar54 wrote: Joan, Thnaks for the tip. I have entered the code (using the names of my objects) and it does not seem to work. Below is the code. Can you provide some further insight? Z Dim ssql As String ssql = "SELECT sectionID, actregID, section, description" & "From tblCAPS WHERE actregID=&me.ActReg" & "ORDER BY section,description" Me.Sect.RowSource = ssql "Joan Wild" wrote: See http://www.pacificdb.com.au/MVP/Code/ComboRS.htm -- Joan Wild Microsoft Access MVP Zoltar54 wrote: I am working with a databse that has 22 seperate tables. On my form I have a combobox that is titled Acts and Regulations. This combobox is populated with data from one table. When one of the options is selected I would like to load a second combobox with the corresponding date eg: when Financial Tracking Regulations is selected I want the second combobox to be populated by the table titled Financial Regulations. Can someone help me with this? Z |
#10
|
|||
|
|||
Load combobox based on selection
Once the user has made a selection from the combobox called "Section" I want
this item to be entered into a table called "Infraction" in a field called "Section". The Financial Regulations Combobox is now called Acts and Regulations. z "Joan Wild" wrote: One doesn't 'load a table' into a combobox, exactly. Keep going. Suppose the second combo box listed all the records in the CAPS table. Then what do you want to do? Also, what happened to the Financial Regulations combobox? -- Joan Wild Microsoft Access MVP Zoltar54 wrote: I tend to do that. The items in the Acts and Regulations box are loaded from a single data table. Each item in the list refers to a seperate table. In this case when the item CAPS is selected from the first combobox, I would like to have the records in the table called CAPS to be loaded into the second combobox called "Section". I hope this is a little bit clearer. Z "Joan Wild" wrote: You've confused me now. Why are you trying to load a table.? I thought you had a form with a combobox named [Acts and Regulations] and a second named (actually I don't know what it's named but it contains Financial Regulations). You want to make a selection in the Acts and Regulations combobox, that then restricts the list of values to select in the second combobox. Please explain how the tblCAPS comes in to play. -- Joan Wild Microsoft Access MVP Zoltar54 wrote: Joan, Thanks once again. The code no longer gives me an error, however it will not load the data in the tbl CAPS. As I am quite new at the VBA and Access world perhaps I am missing something. The item called tblCAPS - this is the taable I want loaded when a particular Item is selected from the first combobox. Does this need to defined (Dim) and if so what do I define it as (recordset, access object etc..) Z "Joan Wild" wrote: ssql = "SELECT sectionID, actregID, section, description From tblCAPS WHERE actregID= " & me.ActReg & " ORDER BY section,description" You have misplaced '&' and quotes. -- Joan Wild Microsoft Access MVP Zoltar54 wrote: Joan, Thnaks for the tip. I have entered the code (using the names of my objects) and it does not seem to work. Below is the code. Can you provide some further insight? Z Dim ssql As String ssql = "SELECT sectionID, actregID, section, description" & "From tblCAPS WHERE actregID=&me.ActReg" & "ORDER BY section,description" Me.Sect.RowSource = ssql "Joan Wild" wrote: See http://www.pacificdb.com.au/MVP/Code/ComboRS.htm -- Joan Wild Microsoft Access MVP Zoltar54 wrote: I am working with a databse that has 22 seperate tables. On my form I have a combobox that is titled Acts and Regulations. This combobox is populated with data from one table. When one of the options is selected I would like to load a second combobox with the corresponding date eg: when Financial Tracking Regulations is selected I want the second combobox to be populated by the table titled Financial Regulations. Can someone help me with this? Z |
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Ordering data based on a selection | Mike | Using Forms | 1 | March 5th, 2006 10:41 PM |
outomatically fill in fields based on the selection in the switchb | Waynef | New Users | 2 | October 7th, 2005 08:16 AM |
Populate a text box based on the selection of a combo box. | Itman79 | Using Forms | 5 | September 11th, 2005 05:12 PM |
Newbie: Need my combo box to populate another field based on selection | Beeman | General Discussion | 4 | June 17th, 2005 07:17 PM |