I am using the following code to copy a record, and open it in another form.
I then want to clear some of the fields etc but when I do it does it to the original record in the form I have already closed!
It says "The expression you entered refers to an object that is already closed or doesnt exist"
I have tried
but that doesnt seem to work.
Here is my code (its in the SEARCH form, after copying it opens the ECL form):
I then want to clear some of the fields etc but when I do it does it to the original record in the form I have already closed!
It says "The expression you entered refers to an object that is already closed or doesnt exist"
I have tried
Code:
DoCmd.RunCommand (acCmdSelectRecord)
Here is my code (its in the SEARCH form, after copying it opens the ECL form):
Code:
Private Sub CreateSub_Click()
'On Error GoTo errorhandling1
'remember original QDBID
Dim OGquote1 As Long, OGquote2 As String
OGquote1 = Me.QuoteDBID
' Open in ECL
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "ECL FORM 2"
stLinkCriteria = "[QuoteDBID]=" & Me![QDBID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
' Copy to a new record
DoCmd.RunCommand (acCmdSelectRecord)
DoCmd.RunCommand (acCmdCopy)
DoCmd.GoToRecord acDataForm, "ECL FORM 2", acNewRec
DoCmd.RunCommand (acCmdPaste)
DoCmd.Close acForm, "Search Form"
' DELETE ALL UNWANTED FIELDS!
[Full Quote Num] = Null
[Suffix] = Null
[Parent Quote] = Null
' etc...
Last edited: