Copy record from one form to another

carahorse

Registered User.
Local time
Today, 15:23
Joined
Apr 1, 2013
Messages
36
ok so I have two forms open: One is a SP Bookings form with a subform SPDetails Query subform. The other form is the not connected/related SP Contacts Query form, to which users enter Full Name weight age ect. Need to copy the names of the new customers Full Name to the Lookup Contact Column in SPDetails Query subform. I got this far, with my trial runs are commented out. The only thing it does when I click on the button is move to new record on Sp Contacts Query Full Name and Copy the previous record. How do I get the button to copy the Full Name from form SPContacts Query.Full Name to the SPBooking Query.subform SPDetails Query Subform.LookupContact


Code:
Private Sub Command52_Click()
Me.Full_Name.SetFocus
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.GoToRecord , "SPDetails Query subform", acNewRec
DoCmd.RunCommand acCmdPasteAppend
'Forms![SPDetails Query subform].[Lookup Contact].SetFocus
'Me.SPDetails_Query_subform.SetFocus
'DoCmd.GoToRecord , "SPDetails Query subform", acNewRec
'DoCmd.GoToRecord , , acNewRec
'Forms![Add New SPContacts Query].Refresh
'Forms![Add New SPBookings].Refresh
'SendKeys "+({f9})"
'DoCmd.GoToRecord , "SPDetails Query subform", acNewRec
End Sub

:banghead:
been tryng this for days help! thanks in advance!
 
Really, the only way to do this kind of thing is using SQL action queries that act directly on the data in the tables. These DoCmd actions you are running are essentially the same kinds of commands you can execute from the menu or ribbon, and at that high a level you just don't have the control you need to do such a detailed and specific task.

My $0.02
 
Oh I second that, any suggestions on a query? Where to place it and how to execute? Sql is my next learning curve
Could I get a possible example? And question, how would the query know which contacts are just entered and belong to the details table? My tables are related by Bookings> Details> Customers
 
Open the query design grid and start trying to get stuff to work in there. You can drag in tables, select fields, specify criteria, and see how it goes. If you run into snags, post back.
 

Users who are viewing this thread

Back
Top Bottom