Looping - Text Box in Header - Update Text Box in Detail

J

Jani

I've been looking/reading how to do this but am stumped. In a header I have
an unbound text box named "txtSelectRequestor"; in the detail section there
are rows of information pulled from a temp table and the number of rows will
vary. Each row has a bound combo field named "cmbRequestor." Because there
could be up to 50 rows and for most of the rows, the requestor will be the
same, I would like to loop through the rows and have the "cmbRequestor" field
updated to the name selected in "txtSelectRequestor." I'm using a combo in
the detail section as the option to make a different selection is necessary.
If anyone can provide some VBA code, it would be so very much appreciated.
Thank you in advance!!!
 
P

Piet Linden

I've been looking/reading how to do this but am stumped. In a header I have
an unbound text box named "txtSelectRequestor"; in the detail section there
are rows of information pulled from a temp table and the number of rows will
vary. Each row has a bound combo field named "cmbRequestor." Because there
could be up to 50 rows and for most of the rows, the requestor will be the
same, I would like to loop through the rows and have the "cmbRequestor" field
updated to the name selected in "txtSelectRequestor." I'm using a combo in
the detail section as the option to make a different selection is necessary.
If anyone can provide some VBA code, it would be so very much appreciated..
Thank you in advance!!!

If all the data in the temp table is just for the given
txtSelectRequestor value, then just use an update query.

dim strSQL as string 'place to build the update query
strsql = "UPDATE MyTable SET RequestorID = '" & me.cmbRequestor & "'"
Currentdb.Execute strsql, dbfailonerror
 
J

Jani

Thanks much Piet! jms

Piet Linden said:
If all the data in the temp table is just for the given
txtSelectRequestor value, then just use an update query.

dim strSQL as string 'place to build the update query
strsql = "UPDATE MyTable SET RequestorID = '" & me.cmbRequestor & "'"
Currentdb.Execute strsql, dbfailonerror
 

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

Top