Hi guys
With some help i had previously been able to make a button on my form that copied that record to a new record (depending on which check boxes were ticked).
It all worked ok but after some more work on the database im getting a runtime error 438 when trying to run the command button.
I have check all the controls and made sure there is a chk tick box for each one. Dont know what else to try.
Thanks
With some help i had previously been able to make a button on my form that copied that record to a new record (depending on which check boxes were ticked).
It all worked ok but after some more work on the database im getting a runtime error 438 when trying to run the command button.
I have check all the controls and made sure there is a chk tick box for each one. Dont know what else to try.
Thanks
Code:
Private Sub cmdfill_Click()
Dim strSQL As String
strSQL = "SELECT * FROM tblTicketing WHERE StockNumber = '" & Me.StockNumber & "'"
DoCmd.GoToRecord acDataForm, Me.Name, acNewRec
Dim c As Control
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
Me.Painting = False
For Each c In Me.Controls
If Not TypeOf c Is CheckBox Then
If Not TypeOf c Is Label Then
If Not TypeOf c Is CommandButton Then
If Me.Controls("chk" & c.Name) = -1 Then
Debug.Print c.Name
c = rs(c.ControlSource)
End If
End If
End If
End If
Next c
Me.Painting = True
rs.Close
Set rs = Nothing
End Sub
Last edited: