Double Click Copy Paste

G

Guest

I have a Mainform with two fields named Recording and InstDate. Also, have a
Subform with two fields named Recording and InstDate. The data from these
tables are unrelated.

Without selecting Recording from the Subform and doing it again with the
InstDate and copying and pasting each individually, I would like to select a
record in the Subform by Double Clicking it to copy both fields and set focus
to the record in the Mainform and paste.

Mainform = Ownership Table
Subform = Inst Table (both fields in same recordset here)
Both forms continuous
Recording is Text in both tables (Ex. 399/100)
InstDate is Date in both tables (Ex. 10/7/2007)
Using Access 2003

Could anyone help with this DblClick Event. This could save a lot of time.
 
P

pietlinden

I have a Mainform with two fields named Recording and InstDate. Also, have a
Subform with two fields named Recording and InstDate. The data from these
tables are unrelated.

Without selecting Recording from the Subform and doing it again with the
InstDate and copying and pasting each individually, I would like to select a
record in the Subform by Double Clicking it to copy both fields and set focus
to the record in the Mainform and paste.

Mainform = Ownership Table
Subform = Inst Table (both fields in same recordset here)
Both forms continuous
Recording is Text in both tables (Ex. 399/100)
InstDate is Date in both tables (Ex. 10/7/2007)
Using Access 2003

Could anyone help with this DblClick Event. This could save a lot of time.

either use RunSQL to run an insert query or
use a recordset and add a couple of records and set the values

Why do you have Recording and InstDate in both tables? Are you joining
on both of them?
 
G

Guest

This form is like an accounting program. I have to debit the owner by using a
button that inserts a blank record in the mainform. I select the instrument
Recording and InstDate where they convey their interest. Then I move through
this record to OwnerNext and DoubleClick to add a record for new Owner and it
assigns a new OwnerID and sets focus to Recording and should insert Recording
and InstDate. Below is the code, I'm sure its missing error checking and
other things. I'm very new with this. I appreciate any help. Thanks in
advance.

Private Sub Recording_DblClick(Cancel As Integer)

Dim rstInst As Recordset
Dim strRecording As String
Dim strInstDate As String
'Set recordset to Inst table
Set rstInst = dbsCurrent.OpenRecordset("Inst", dbOpenSnapshot)
' Get Recording form subform and set to varible
strRecording = Forms!Ownership![Inst Subform]!Recording
' Get InstDate form subform and set to varible
strInstDate = Forms!Ownership![Inst Subform]!InstDate
Forms!Ownership!Recording.SetFocus
' Set varible to Recording in mainform
Forms!Ownership!Recording = strRecording
' Set varible to InstDate in mainform
Forms!Ownership!InstDate = strInstDate
' Cleanup
rstInst.Close

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top