Re: Auto update query





"John W. Vinson" wrote:

On Wed, 23 Jan 2008 15:49:03 -0800, He cries for help
<Hecriesforhelp@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

I do want to store this information as a part of the database, this form and
its information will be a record for government contracts.

Sorry, but that is incorrect.

A Form IS NOT A RECORD.

A form is a *window* which can flexibly and dynamically display data.

You store information in tables. If it needs to be a permanent, unchangable
record, Access is not an appropriate medium.

I need to recall
this info when needed and the fields I have refered to in this posting is
intergal. This information in not being actually saved in two locations, the
vendor table is informational only imported from a excel database,the main
table posnow is where all the info will be stored. I would have never thought
that autofilling four boxes on a form and saving this info upon exiting would
have been this hard.

It's NOT hard.

Suppose you store an address in the POSNOW table.

You then get another vendor table with a corrected address for a vendor. The
address you had previously was wrong, and the new spread*** corrects that
error.

If you have stored the address in the posnow table, THAT ADDRESS IS WRONG.

Is it your business rule that you should store incorrect data permanently,
even when a correction is available?

IF you really want to do so - and I'll still argue That It Is A Bad Idea - you
can use VBA code in a combo box's AfterUpdate event to copy fields from the
combo box's row source into bound textboxes on the form:

Private Sub cboVendor_AfterUpdate()
If Not IsNull(Me!cboVendor) Then
Me!txtAddress = Me!cboVendor.Column(2)
Me!cboPhone = Me!cboVendor.Column(3)
<etc>
End If
End Sub

Note that the Column() property is zero based; (2) means the third column in
the combo's row source query.

John W. Vinson [MVP]

.


Loading