By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,148 Members | 779 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,148 IT Pros & Developers. It's quick & easy.

Populating fields when adding new record via datasheet subform

P: 2
I have an unbound form/subform where I populate a combo box on the main form, and using the onchange event, display fields from a table in a datasheet subform.

I want to add a new record via the subform, allowing the user to type certain fields but complete other fields via code in the beforeinsert event as follows

Private Sub Form_BeforeInsert(Cancel As Integer)
Me.Kitchen = Me.Parent.Kitchen(2)
Me.lookupRoute = Me.Parent.Kitchen(1)

End Sub

Me.Kitchen and me.lookupRoute are columns on the datasheet, Me.Parent.Kitchen is a combo box on the parent form.

I get the following error when trying this

Runtime error 451 Property let procedure not defined and property get procedure did not return an object

Any ideas?

Regards
Pete
Aug 27 '08 #1
Share this Question
Share on Google+
3 Replies


100+
P: 167
It's not clear here what Kitchen(1) and Kitchen(2) stand for.
I assume they are first and second column in the drop-down list of your combo control named Kitchen.

In that case try reffering to them using column property.
Expand|Select|Wrap|Line Numbers
  1. Me.Kitchen = Me.Parent.Kitchen.Column(1)
  2. Me.lookupRoute = Me.Parent.Kitchen.Column(0)
Aug 27 '08 #2

P: 2
Thanks for that, I've been looking at this for ages, and couldn't see what was wrong.

Works fine now.

Regards
Pete
Aug 27 '08 #3

100+
P: 167
You're welcome Pete.
Good luck with your project!
Aug 28 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.