Auto Populating a Field

leo31

Registered User.
Local time
Yesterday, 19:52
Joined
Feb 16, 2008
Messages
21
In case my other question cant be resolved, I'd like to do a work around, but dont know how to do that either.

So, I have a form (Photos) with a field (PhotoTitle) and in the form is a subform containing a continuous form a (Sales).

This form contains invoiceno, location, customer etc... but also PhotoTitle field.

I've been trying to get it to populate based on a relationship and use that data elsewhere, but cant, so I'd then like it to.. on enter (or focus) automatically populate with the value from the main form (photos), phototitle field and put it into the sales subform phototitle field.

What is the code for doing that?

Thanks!
 
You don't need to code it, the subform wizard will do that for you, providing the link field has the same name in both datasets. Create the main form and subform separately. Open the main form in design view, make sure the subform wizard button is clicked, drag the subform from the form window and drop it onto the main form. The wizard will create the parent/child link.
 
In what way does it not work?

Have you checked the parent/child links in the subform properties?
 
it doesnt automatically put the value of Form.Photos.PhotoTitle into SubForm.Sales.PhotoTitle.

Even if I point the subform field to pull the value from the photos fields, it doesnt remember if for the customer purchase table use.

I would have thought, if I have a subform within a form and they are linked via the unique value of filename, then I should be able to pull that value and retain it in a matching field on the subform?

Basically, should I be able to have corresponding fields in the subform and get the values in the main form automatically?
 
it doesnt automatically put the value of Form.Photos.PhotoTitle into SubForm.Sales.PhotoTitle.
Yes, they are linked using Filename
I don't understand how these can both be true. If the link is Filename, why would you want to populate bothe forms with PhotoTitle?
 
ok.

maybe I could do it a different way, and this could be my lack of access programming here but...

I should be able to open a photo record which contains its title, and see a list of sales in a subform. I can, great!

However, if I open a customer form with an embedded subform of customer purchases (which is basically a read only version of sales with the data from sale table) I need to see the Phototitle there, otherwise its a meaningless list.

Maybe that is my problem, in that I should be using the sales form, not the customerpurchases.

I have used a different form, as I dont want to actually show phototitle in the sales list on the photo form, I only need to show it on the customer purchase list, but the problem seem to stem from the fact I cant store the phototitle value in the sales table.

Does that make sense?
 
Ah, beginning to understand. I think that you need to base your subform on a query that joins your sales data with the phototitle data. You can't populate this field on th fly, it should be in the dataset on which the subform is based.
 
ok, great. So where of how should I create that query? ...



** Update, Yes!! I think that works! Or atleast in my test db, I'll now try it in the live one! I seem to have a funny dataform as well, but I'll try it in the live db and let you know. Hopefully have will work for customer purchases too!

Thanks so much for your help so far!
 
Last edited:

Users who are viewing this thread

Back
Top Bottom