mike60smart
Registered User.
- Local time
- Today, 14:18
- Joined
- Aug 6, 2017
- Messages
- 2,121
Hi everyone
I have posted the same question on Utter Access
The code I am using as as follows and I am getting the following error.
Any help appreciated
I have posted the same question on Utter Access
The code I am using as as follows and I am getting the following error.
Code:
Private Sub cmdAddLines_Click()
10 On Error GoTo cmdAddLines_Click_Err
20 If Me.Dirty Then Me.Dirty = False
30 If DCount("[MainId]", "tblLineUnitEntries", "[MainId] = " & Me.txtMainID) <> 0 Then
40 Me.Undo
50 If MsgBox("These Line Items already exist", vbOKCancel) = vbOK Then
60 Exit Sub
70 Else
80 DoCmd.RunMacro "mcrAddLines" 'Runs an append query tp add a specific number of records
Dim strSQL As String
90 strSQL = "UPDATE tblLineUnitEntries SET MainID = " & Me.txtMainID _
& " WHERE MainID Is Null;"
100 Debug.Print strSQL
110 CurrentDb.Execute strSQL, dbFailOnError
120 [Forms]![frmMachines]![frmMainData]![frmLineUnitEntriesSubform].Requery
130 End If
140 Exit Sub
cmdAddLines_Click_Exit:
150 Exit Sub
cmdAddLines_Click_Err:
160 MsgBox Error$
170 Resume cmdAddLines_Click_Exit
End Sub
Any help appreciated