**What I want to happen: I, or the user, will be entering in multiple new records that are almost identical, besides maybe one Combo Box having a different value every time. So, when I click on the button to enter the new record, I want the values in my Combo Boxes (besides the one that will change every time--ToteNumber) to remain in the Combo Boxes, so that I only have to re enter the value for my one field, instead of having to re-type all the values over again.
As I said, I have done a lot of research and have come across posts about "Copy Field / Record Cloning" but have not been successful executing it. What I have now is a Macro that I've have assigned to the "Execute Action" Event (with NO action on the general tab of the push button assigned--i.e. "New Record") is as follows:
Code: Select all
Sub Clone_To_New_Record (oEvent As Object) 'Button > Execute > event
DIM oForm As Object
DIM oStatement
DIM sColumns As String
DIM iTransactionID As Integer
DIM sSQL As String
oForm = oEvent.Source.Model.Parent
IF oForm.isNew THEN Exit Sub
iTransactionID = oForm.Columns.GetByName("TransactionID").Value ' "TransactionID" is the Primary Key in my table "Transaction"
oForm.updateRow()
oForm.moveToInsertRow()
oStatement = oForm.ActiveConnection.createStatement() 'Create an SQL statement object
sColumns = ""
sColumns = sColumns & """Date"""
sColumns = sColumns & ", ""ScanLocID"""
sColumns = sColumns & ", ""ToteNumber"""
sColumns = sColumns & ", ""BOLNumber"""
sColumns = sColumns & ", ""Process"""
sSQL = "INSERT INTO ""Transaction"" (" & sColumns & ") SELECT " & sColumns & " FROM ""Transaction"" WHERE ""TransactionID"" = " & iTransactionID
oStatement.executeUpdate( sSQL ) 'Execute the SQL command
oForm.reload()
oForm.last()
End Sub
Combo Boxes: ScanLocID ; ToteNumber ; BOLNumber ; Process ; Date
Not sure where to go from here and appreciate any advice/guidance provided. Thanks in advance!