Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update fields in table without form

Status
Not open for further replies.

Telsa

Programmer
Jun 20, 2000
393
US
How do I update a field in a table without the form but with code?


THis is what I have done:
I have a parse created for a field from a form and need to update the pieces of the string into separate fields. The fields are created and in the same table as the field on the form. How do I reference the fields that are not on the form????

Here's a sample..

tblSubmittal.Region2 = Mid(strString, intNewStart)

Here the tblSubmittal is the name of the table and Region2 is a field in that table.

How do I get the data grabbed by the Mid function placed in there???

Thanks!

Mary :)
[sig][/sig]
 
If I understand your question right, the field (Region2) is an available field in the Record Source of the form, you just don't HAVE it on the form, is that correct?

If so, then:

Add the Region2 field to the form, and make the visible property false
Now on an event (Click of a button, After Update of a field, etc.) put the following:
==========
Me.Region2 = Mid(Me.txtField, 2, 3) ' using the appropriate numbers in the Mid function

Even though the field is not visible, you can manipulate the data in it.

I'm not sure if that is what you want or not. If not, then you may have to use DAO (code) to manipulate the data in the table. [sig]<p>Jim Lunde<br><a href=mailto:compugeeks@hotmail.com>compugeeks@hotmail.com</a><br><a href= Application Development[/sig]
 
Thanks! That is what I did end up doing. Although it is easier, I was hoping to learn to do it the &quot;hard&quot; way through code. *G*

Mary :eek:) [sig][/sig]
 
If the fields are all from the same table, you may as well do it this way. If you need to update data from a different table, then code is a good way to go. When you run into a situation like that, be sure to come back the Tek-Tips, there are many capable folks to help walk you through it! [sig]<p>Jim Lunde<br><a href=mailto:compugeeks@hotmail.com>compugeeks@hotmail.com</a><br><a href= Application Development[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top