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

How do I set a subform field equal to an unbound parent field?

P: 5
I am creating a data-entry form with several steps to make sure the user puts things in a particular way and I'm having some issues I am hoping somebody can help with.

1. Form # 1 - fromTruckCollection
Unbound form. Requires the user to enter 3 pieces of information and will not let them move to the data-entry table without this information. This form works perfect.
1. Truck Number
2. Route Fill ID
3. Collection Date
I get the three things I need form the user, above, then the form opens the new form and passes the information to the new form (frmCollection) as a string.

2. Form 2 - frmCollection
I use OpenArgs to take the string from the first form apart into usable information I need for my data entry in this form.

Private Sub Form_Open(Cancel as Integer)
Dim Truck, WeekDay, CollectionDate
Truck = Split(Me.OpenArgs, ";")(0)
WeekDay = Split(Me.OpenArgs, ";")(1)
CollectionDate = Split(Me.OpenArgs, ";")(2)

DateValue(CollectionDate)

End Sub

I know the information is coming across correctly because I'm able to use Truck and WeekDay to run a query on open that pulls up all the correct information the end-user needs for data entry.

Here's the issue. The CollectionDate is not use in frmCollection. It's actually a value that I need to save in the subform frmCollectionsubform.

Because CollectionDate is not an actual bound field on frmCollection I cannot seem to get the DateValue of Collection Date from the Parent form, frmCollection, to the Subform, frmCollectionsubform.

Actually, I take that back. I was able to get it to work one time, but it didn't actually save the value in the subform, I was simply displaying what was in the very first form, frmTruckCollection. However, I really need to save the date in the subform. The reason I'm trying to do this is because the exact same date gets entered for all the data-entry the user is doing. It could be 32 records, it could be 15. So I'm trying to save the data-entry use some time.

I hope I've explained this correctly. I appreciate any help anyone can offer. Thank you.
Aug 3 '17 #1

✓ answered by NeoPa

I'm not saying you can't (and certainly not that you shouldn't) refer to that information. Simply that you'll find it a lot easier to do if you ensure you have a Control set up with the information in rather than relying on getting to the data source field directly.

I would encourage you to use your skills and imagination to ensure the system works as smoothly and comfortably for the user as you can. This can reduce errors as well as leaving the customer happier. What's not to like.

Share this Question
Share on Google+
5 Replies


Expert 100+
P: 1,221
Maybe there's an issue with how you are setting up the OpenArgs. But you don't really need to do that if there is a form/subform relationship. In the subform you can refer to me.parent.fieldname to get the value of any field in the parent form.

Jim
Aug 5 '17 #2

P: 5
Thanks for replying Jim. Yes, I thought that it should work also, but I'm thinking it's because my parent form doesn't actually have the CollectionDate field on it. The parent form pulls a query that selects the vending machines that we are entering the information for, it's not a table where the information is going. Does that make sense?
Aug 11 '17 #3

NeoPa
Expert Mod 15k+
P: 31,417
Referring to a field, rather than a control, is at least very complicated. If you need the data available then using a bound control is much more straightforward.
Aug 11 '17 #4

P: 5
Thanks NeoPa, you're correct. In my quest to make the end-user experience as easy as possible I'm driving myself crazy.

I can leave the CollectionDate blank and force the user to enter the exact same date in the subform for every record, it just so much repetitive information.
Aug 14 '17 #5

NeoPa
Expert Mod 15k+
P: 31,417
I'm not saying you can't (and certainly not that you shouldn't) refer to that information. Simply that you'll find it a lot easier to do if you ensure you have a Control set up with the information in rather than relying on getting to the data source field directly.

I would encourage you to use your skills and imagination to ensure the system works as smoothly and comfortably for the user as you can. This can reduce errors as well as leaving the customer happier. What's not to like.
Aug 15 '17 #6

Post your reply

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