Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Compare Database
- Private Sub cmdAdd_Click()
- If Me.txtName.Tag & "" = "" Then
- CurrentDb.Execute "INSERT INTO [import]([product name], [QtyImport], [ImportDate])" & _
- " VALUES('" & Me.txtName & "'," & Me.txtOrderedQty & ",#" & Me.txtDate & "#)"
- Else
- CurrentDb.Execute "UPDATE import " & _
- " SET [product name] = '" & Me.txtName & "'" & _
- ", [QtyImport] = " & Me.txtOrderedQty & "" & _
- ", [ImportDate] = #" & Me.txtDate & "#" & _
- " WHERE [product name] = '" & Me.txtName.Tag & "'"
- End If
- cmdClear_Click
- importSubform.Form.Requery
- End Sub
- Private Sub cmdClear_Click()
- Me.txtName = ""
- Me.txtOrderedQty = ""
- Me.txtDate = ""
- Me.txtName.SetFocus
- Me.CmdEdit.Enabled = True
- Me.CmdAdd.Caption = "Add"
- Me.txtName.Tag = ""
- End Sub
- Private Sub CmdEdit_Click()
- If Not (Me.importSubform.Form.Recordset.EOF And Me.importSubform.Form.Recordset.BOF) Then
- With Me.importSubform.Form.Recordset
- Me.txtName = .Fields("product name")
- Me.txtOrderedQty = .Fields("QtyImport")
- Me.txtDate = .Fields("ImportDate")
- Me.txtName.Tag = .Fields("Product Name")
- Me.CmdAdd.Caption = "Update"
- Me.CmdEdit.Enabled = False
- End With
- End If
- End Sub
- Private Sub cmdExit_Click()
- DoCmd.Close
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement