Tupacmoche
Registered User.
- Local time
- Today, 12:31
- Joined
- Apr 28, 2008
- Messages
- 291
Hi All,
This code worked fine once when, I wrote it. Then when testing it again the PasteAppend button became grayed out. In this code, I call the Paste Append functionality from code but now, I get this error: Run-time error '2046' The command or action 'PasteAppend' isn't available now. Why? What did, I do to disable it? I have googled many articles about adding library references ect but it still does not work. I have even see numerous discussions on this site but can't get it to work. Can anyone see what, I'm missing?
Here is the code:
Private Sub btnClear_Click()
Dim LResponse As Integer
Dim msg1 As String
Dim msg2 As String
Dim cdb As DAO.Database
Dim qdef As DAO.QueryDef
msg1 = "You have choosen to continue..."
msg2 = "Exiting... User has canceled."
LResponse = MsgBox("Are you sure you want to clear old MRN's and add new ones?", vbYesNo, "Continue")
If LResponse = vbYes Then
'MsgBox (msg1)
Set cdb = CurrentDb
Set qdef = cdb.CreateQueryDef("")
qdef.Connect = cdb.TableDefs("dbo_MRN_Import").Connect
qdef.SQL = "EXEC dbo.sp_MRN_CleanUp"
qdef.ReturnsRecords = False
qdef.Execute dbFailOnError
Set qdef = Nothing
Set cdb = Nothing
Me.MRN_Inport_subform.Requery
MsgBox ("Old MRN's deleted, click ok to add new import.")
RunCommand acCmdPasteAppend
MsgBox ("Update Complete...!")
Else
MsgBox (msg2)
End If
End Sub
This code worked fine once when, I wrote it. Then when testing it again the PasteAppend button became grayed out. In this code, I call the Paste Append functionality from code but now, I get this error: Run-time error '2046' The command or action 'PasteAppend' isn't available now. Why? What did, I do to disable it? I have googled many articles about adding library references ect but it still does not work. I have even see numerous discussions on this site but can't get it to work. Can anyone see what, I'm missing?

Private Sub btnClear_Click()
Dim LResponse As Integer
Dim msg1 As String
Dim msg2 As String
Dim cdb As DAO.Database
Dim qdef As DAO.QueryDef
msg1 = "You have choosen to continue..."
msg2 = "Exiting... User has canceled."
LResponse = MsgBox("Are you sure you want to clear old MRN's and add new ones?", vbYesNo, "Continue")
If LResponse = vbYes Then
'MsgBox (msg1)
Set cdb = CurrentDb
Set qdef = cdb.CreateQueryDef("")
qdef.Connect = cdb.TableDefs("dbo_MRN_Import").Connect
qdef.SQL = "EXEC dbo.sp_MRN_CleanUp"
qdef.ReturnsRecords = False
qdef.Execute dbFailOnError
Set qdef = Nothing
Set cdb = Nothing
Me.MRN_Inport_subform.Requery
MsgBox ("Old MRN's deleted, click ok to add new import.")
RunCommand acCmdPasteAppend
MsgBox ("Update Complete...!")
Else
MsgBox (msg2)
End If
End Sub