Populate record in form based on another (1 Viewer)

Sandpiper

Registered User.
Local time
Today, 00:07
Joined
Feb 21, 2006
Messages
55
hi all

I'm sure this is simple, but i'm really struggling, if anyone can point me in the right direction, i'd be grateful.
I've got an open form which needs to be populated with an existing address.
Whilst the original form (based on table tblDelivery) stays open with a part completed record, another form pops up (based on tblAddress) giving the user a choice of addresses to complete the record.
When a button next to the correct address is clicked, I would like the details of that address to populate the fields in the original form.

There are only 4 address fields named the same in each form/table
AddressL1
City
County
PCode.

Any advice please?
thanks - from an amateur.
 

boblarson

Smeghead
Local time
Yesterday, 16:07
Joined
Jan 12, 2001
Messages
32,059
Okay, some advice:

1. You do not store the same data more than once (with the exception of a numeric KEY which identifies the unique record).

2. That means that you should not be storing the same address over and over.

3. You should normalize your database. It sounds like you have a non-normalized design possibly with multiple address fields in the same form/table.

Perhaps a good read is in order.
 

Sandpiper

Registered User.
Local time
Today, 00:07
Joined
Feb 21, 2006
Messages
55
Thanks for the information.
This is a database i've inherited, but I think the reason that it is set up this way is because the address fields in the main record can be populated from multiple sources, either Suppliers, Customers or in this case Deliveries.
I guess the answer would be to combine these three tables into one with a field which indicates which category the address is in, but at this stage, that would mean far too many changes, and i'd probably just mess more forms/reports up that i'd fix, so for now, I'd like to just store these 4 bits of data from the delivery address table (albeit incorectly).

Can it be done?

Thanks
 

HAMMAMABUARQOUB

Registered User.
Local time
Today, 02:07
Joined
Jul 29, 2009
Messages
75
sometimes normalization can be a barrage to the programming issues like this,,
for example, if you have an invoice form and subform, you need to choose the Item to be sold from a combo box, this combo should poplulate the Price, cost, and current available Qnty, if you use them in non-bound fields, this will creat a problem that all the next records will hold the same value for these field as the first, that's not logical, but normalixed databse!
i use a method to deal with such cases: the programmer's fields and the datbase field! so you can violate normalization just to ensure you deliver the needed requirements by you customers
 

DCrake

Remembered
Local time
Today, 00:07
Joined
Jun 8, 2005
Messages
8,626
Anyway to answer your questions

Forms("Callingform")("Addresscontrol") = Me.AddressField

Where CallinfForm is the name of the underlying form and Addresscontrol is the textbox you want to populate. The Me.AddressField is the data on the form that has the current focus that you want to copy.

David
 

Sandpiper

Registered User.
Local time
Today, 00:07
Joined
Feb 21, 2006
Messages
55
Thank you so much.

I was very close, but not using the brackets/"" correctly.

Thanks.
 

Users who are viewing this thread

Top Bottom