gerard1979
MIS
I get a function for this with 2 columns but now I need for three. I'll tried:
'Om locaties toe te voegen
Function Append2Table4(cbo As ComboBox, NewData As Variant) As Integer
On Error GoTo err_append2table4
Dim rst As DAO.Recordset
Dim vField1, vField2 As Variant
Append2Table4 = acDataErrContinue
vField1 = "loc_beschrijving"
vField2 = "loc_werkbonID"
If Not IsNull(NewData) Then
If Bevestigen("Wilt u " & NewData & " toevoegen aan de lijst met locaties?"
Then
Set rst = CurrentDb.OpenRecordset(cbo.RowSource)
rst.AddNew
rst(vField1) = NewData
rst(vField2) = TempWerkbonID
rst.Update
rst.Close
Append2Table4 = acDataErrAdded
End If
End If
exit_append2table4:
Set rst = Nothing
Exit Function
err_append2table4:
MsgBox Err.Description
Resume exit_append2table4
End Function
but it failed on rst = currentdb.recordset(cbo.recordsource)
error: to few parameters, 1 expected
anyone understand the problem, thnx
Gerard
'Om locaties toe te voegen
Function Append2Table4(cbo As ComboBox, NewData As Variant) As Integer
On Error GoTo err_append2table4
Dim rst As DAO.Recordset
Dim vField1, vField2 As Variant
Append2Table4 = acDataErrContinue
vField1 = "loc_beschrijving"
vField2 = "loc_werkbonID"
If Not IsNull(NewData) Then
If Bevestigen("Wilt u " & NewData & " toevoegen aan de lijst met locaties?"
Set rst = CurrentDb.OpenRecordset(cbo.RowSource)
rst.AddNew
rst(vField1) = NewData
rst(vField2) = TempWerkbonID
rst.Update
rst.Close
Append2Table4 = acDataErrAdded
End If
End If
exit_append2table4:
Set rst = Nothing
Exit Function
err_append2table4:
MsgBox Err.Description
Resume exit_append2table4
End Function
but it failed on rst = currentdb.recordset(cbo.recordsource)
error: to few parameters, 1 expected
anyone understand the problem, thnx
Gerard