Using results from a subform to populate the main form

andrewhoddie

Board Regular
Joined
Dec 21, 2008
Messages
118
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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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