Solved

Duplicate forms Recordset

Posted on 2013-11-18
3
383 Views
Last Modified: 2013-11-18
Hello, with my code below I'm attempting to populate a forms recordset via an SQL statement then clone the record.

I'm getting the following error:

Within the recordsetclone I'm getting this error on the .AddNew:

"No such interface supported"

Private Sub S_Click()

If MIRROR.Value > "" Then

Dim NewMDRNumber As Integer

'get the selected mdr
Dim myDMR As Integer
myDMR = MIRROR.Value

'fill NewMDRNumber number with next mdr number
NewMDRNumber = DLookup("myDMR", "GetNextDMRID")

'populate forms recored set with select statement
Set RST = New ADODB.Recordset
RST.Open "Select * from [DMR Tracking] Where [DMR#] = " & myDMR & "", _
CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Set Forms("Type of DMR").Recordset = RST

'Duplicate the record
With Me.RecordsetClone
.AddNew
![DMR#] = NewMDRNumber
![DATE Issued] = Me.[DATE Issued]
![TYPE OF DMR] = Me.[TYPE OF DMR]
![PART NUMBER] = [PART NUMBER]
![PART NAME] = [PART NAME]
![Program] = [Program]
![Customer] = [Customer]
![SUPPLIER] = [SUPPLIER]
![Area] = [Area]
![LOT NUMBER] = [LOT NUMBER]
![QTY SUSPECT] = [QTY SUSPECT]
![PPM QUANTITY] = [PPM QUANTITY]
![WHERE LOCATED] = [WHERE LOCATED]
![WHO PREPARED] = [WHO PREPARED]
![QA Eng] = [QA Eng]
![JobNumber] = [JobNumber]
![PINNumber] = [PINNumber]

.Update

'Save the primary key value, to use as the foreign key for the related records.
.Bookmark = .LastModified

'Display the new duplicate.
Me.Bookmark = .LastModified
End With

Exit_Handler:
Exit Sub

Err_Handler:
MsgBox "Error " & Err.Number & " - " & Err.Description, , "cmdDupe_Click"
Resume Exit_Handler

Else

MsgBox "Select the MDR to duplicate."

End If

 
End Sub

Open in new window

0
Comment
Question by:gogetsome
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 51

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 39657196
I believe you need to use DAO.Recordset for the RecordsetClone:

Dim rsClone As DAO.Recordset
Set rsClone = Me.RecordsetClone
rsClone.AddNew

etc.

and probably for the source also.

/gustav
0
 

Author Closing Comment

by:gogetsome
ID: 39657289
Thank you for pointing me in the right direction.
0
 
LVL 51

Expert Comment

by:Gustav Brock
ID: 39657679
You are welcome!

/gustav
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question