thmsjlmnt3953
Registered User.
- Local time
- Today, 20:51
- Joined
- May 20, 2014
- Messages
- 120
Hi,
I currently assign multiple 'skills' to departments using a listbox and a combo using the following code
However as time goes on we may want to add new skills to the depts - ive used dcount to check if the data exists in one field before however how would it be possible to check to see if the data combination exists over deptid and skill
any help would be fab
I currently assign multiple 'skills' to departments using a listbox and a combo using the following code
Code:
Private Sub cmdSaveReq_Click()
Dim strSQL As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim ctl As Control
Dim varItem As Variant
On Error GoTo ErrorHandler
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblRequirements", dbOpenDynaset, dbAppendOnly)
'make sure a selection has been made
If Me.SkillsList.ItemsSelected.Count = 0 Then
MsgBox "No skills selected"
Exit Sub
End If
If IsNull(cmbDept.Value) Then
MsgBox "No department selected"
Exit Sub
End If
'add selected value(s) to table
Set ctl = Me.SkillsList
For Each varItem In ctl.ItemsSelected
rs.AddNew
rs!required_skill = ctl.ItemData(varItem)
rs!deptid = Me.cmbDept
rs.Update
Next varItem
ExitHandler:
Set rs = Nothing
Set db = Nothing
Exit Sub
ErrorHandler:
Select Case Err
Case Else
MsgBox Err.Description
DoCmd.Hourglass False
Resume ExitHandler
End Select
End Sub
However as time goes on we may want to add new skills to the depts - ive used dcount to check if the data exists in one field before however how would it be possible to check to see if the data combination exists over deptid and skill
any help would be fab