dilipramadas
New Member
- Joined
- Feb 8, 2010
- Messages
- 7
Hi Guys,
I'm working on a piece of automation which is based on Access DB form which is linked to SharePoint.
I've created a form with multiple combo boxes and couple of text boxes. After googling a LOT, I was able to automate the event procedure for one of the combo box. But when i tried replicating the same for another combo box, it doesn't work. I've changed the declarations and I've also looked into the tables the
I'm new to Access and tried writing the macro based on the excel VBA I written in past.
Here is what I'm trying to achieve: When the form user selects one option from the 1st combo box, in the 2nd combo box it show a list which corresponds to the selection in 1st combo box.
Below is the code.
Any help on this is appreciated!
Best regards,
Dilip
I'm working on a piece of automation which is based on Access DB form which is linked to SharePoint.
I've created a form with multiple combo boxes and couple of text boxes. After googling a LOT, I was able to automate the event procedure for one of the combo box. But when i tried replicating the same for another combo box, it doesn't work. I've changed the declarations and I've also looked into the tables the
I'm new to Access and tried writing the macro based on the excel VBA I written in past.
Here is what I'm trying to achieve: When the form user selects one option from the 1st combo box, in the 2nd combo box it show a list which corresponds to the selection in 1st combo box.
Below is the code.
Code:
Option Compare Database
Public Function GetDivisionPrivate Sub cboFunction_Change()
Call GetDeptList(cboFunction.SelText)
End Sub
Public Function GetDeptList(sFunctionName As String) As Boolean
Dim db As DAO.Database
Dim Trs As DAO.Recordset
Dim FtrSQL As String
On Error GoTo GetTaskName_Error
GetTaskName = False
Set db = CurrentDb
FtrSQL = "SELECT tb_tasks.[Tasks] ,tb_tasks.[ID] " & _
"FROM tb_function INNER JOIN tb_tasks ON tb_function.ID = tb_tasks.Task_ID " & _
"Where tb_tasks.[Tasks]='" & sFunctionName & "'"
Set Trs = db.OpenRecordset(FtrSQL, dbOpenSnapshot)
Trs.MoveFirst
Me!cboTask = Null
If Not Trs.EOF Then
Me!cboTask.RowSource = FtrSQL
End If
Trs.Close
db.Close
GetTaskName = True
GetTaskName_Error:
'MsgBox Err.Description
End
Any help on this is appreciated!
Best regards,
Dilip