Update a table with 2 concatenated fileds

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that has a club and a branch. I don't want to have users
having to data enter the combined field:
frm_data!combo_field = rtrim([club]) & Rtrim([branch])

I can get it to show the combined field in the form, but can't get it to
write back to the table that the form is based on:

tblZip.comboKey = Forms!frm_data!combo_field

Can somebody tell me how to get this to update the table?
 
I have a form that has a club and a branch. I don't want to have users
having to data enter the combined field:
frm_data!combo_field = rtrim([club]) & Rtrim([branch])

I can get it to show the combined field in the form, but can't get it to
write back to the table that the form is based on:

tblZip.comboKey = Forms!frm_data!combo_field

Can somebody tell me how to get this to update the table?

Don't.
Keep the data in 2 separate fields.
Anytime you need the combined data, combine it, in a query, form, or
report, using the same expression you are now using:
=rtrim([club]) & Rtrim([branch])
 
well ... I tried putting that in as a default field .... it wouldn't really
do anything ...
what I ended up doing was this:

Private Sub Branch_Exit(Cancel As Integer)
Dim ComboKey As String
ComboKey = (RTrim([Club]) & RTrim([Branch]))
Forms!ziptable!CombinedKey = ComboKey
End Sub



fredg said:
I have a form that has a club and a branch. I don't want to have users
having to data enter the combined field:
frm_data!combo_field = rtrim([club]) & Rtrim([branch])

I can get it to show the combined field in the form, but can't get it to
write back to the table that the form is based on:

tblZip.comboKey = Forms!frm_data!combo_field

Can somebody tell me how to get this to update the table?

Don't.
Keep the data in 2 separate fields.
Anytime you need the combined data, combine it, in a query, form, or
report, using the same expression you are now using:
=rtrim([club]) & Rtrim([branch])
 
I have a form that has a club and a branch. I don't want to have users
having to data enter the combined field:
frm_data!combo_field = rtrim([club]) & Rtrim([branch])

I can get it to show the combined field in the form, but can't get it to
write back to the table that the form is based on:

tblZip.comboKey = Forms!frm_data!combo_field

Can somebody tell me how to get this to update the table?

If you're trying to store a combined key, redundantly... DON'T. It's
neither necessary nor good practice!

The table should NOT HAVE a field named comboKey if it also has fields
Club and Branch. The field should simply *not exist*. If the
combination of the two fields is a primary key, simply select both
fields in table design view and click the Key icon to make them a
joint, two-field key.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top