I have a form for entering new records in a main table. If certain conditions are met, it creates a new record in another table (child). The second form is a simple one - it is just an auto-number field and another number field [Rail Entry] that references the record number of the first table. All worked fine until my boss decided he wanted the form to be in datasheet view. Now, it doesn't work at all. The code runs 'After Insert' and I believe this may be the problem, although I don't know how to correct it. Can anyone help?
Dim MyNum As Integer
MyNum = [Record]
If [Type] = "Chips" Then
If [Customer] = 2 Then
Dim dbs As Database, rst As Recordset
Set dbs = CurrentDb()
Set rst = dbs.openrecordset("Domtar Tickets"
rst.AddNew
rst![Rail Entry] = MyNum
rst.Update
rst.Close
Set rst = Nothing
Set dbs = Nothing
End If
End If
Dim MyNum As Integer
MyNum = [Record]
If [Type] = "Chips" Then
If [Customer] = 2 Then
Dim dbs As Database, rst As Recordset
Set dbs = CurrentDb()
Set rst = dbs.openrecordset("Domtar Tickets"
rst.AddNew
rst![Rail Entry] = MyNum
rst.Update
rst.Close
Set rst = Nothing
Set dbs = Nothing
End If
End If