Using results from a subform to populate the main form

andrewhoddie

Board Regular
Joined
Dec 21, 2008
Messages
114
Hello

I have a main form called Handyperson to log all enquires relating to this service. Each time a customer or potential customer rings up it is logged on this form. On this form there is a search button. I have a subform called search which has a search facility and the results are shown on a second subform called ServiceUsersSearchList returning data from table customerdata.

what I would like the search form to do is where there is a matching customer to populate the fields on form Handyperson such as title, forename, surname address and contact number on the click of a command button. if there is no matching customer then the user would fill this detail in manually.

I am a bit confused as to what the code for this would be for the event on click. If anyone has any ideas I would be very grateful

many thanks
Andrew
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I have tired

Private Sub Command7_Click()
Forms![Handyperson].Form.SetFocus
DoCmd.GoToRecord , , acNewRec
Me.Refresh
If IsNull(Surname) Then
'do nothing
Else
Forms!Search!ServiccUsersSearchList!Title.Value = Me.Handyperson.Title.Value
End If
DoCmd.Close
End Sub

but I get a compile error saying method or data member not found. can anyone help?

thanks
Andrew
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top