How to select an entire row And append it?

P

postman

How to highlight an entire row of records and hold this format while user
navigates to correct record, (6 fields) so an append query (via a control)
can then be run to append the selected row to another table.

I have a product search form with:

1. An unbound text box (that is the criteria for a query) for user data
entry eg: Like ([forms]![Frm_FindTitles_DVD]![Input01]) & "*")
2. A control button 'refresh form data' that refreshes form data once data
input complete.
3. a datasheet subform for the query.

When the form opens the curser is in the text box awaiting data entry, the
user then refreshes form data and the records matching query criteria are
shown in the datasheet.

So will need to have the row automatically selected once the form data has
been refreshed (nice), or manually select the row by clicking on the arrow
next to the record row (which highlights that entire row), then
navigating to the record with keyboard up/down keys to select the required
row. I know how to build an append query based on a form controls etc. so
have done that ok. I would guess that the "selected" record row are the
required data for the append query & nothing more needs to be done on the
query.

MY QUESTION:
1. How to highlight an entire record row automatically, and hold this format
while user navigates to correct record.

2. How to use the record row in an append query.
Would the code look like:

INSERT INTO [Tbl_SBuy Temp] ( Title, Format, SPrice, BCPrice, BTPrice )
SELECT Forms!Frm_FindTitles_BOOKS!TITLE AS Expr1,
Forms!Frm_FindTitles_BOOKS!FORMAT AS Expr2,
Forms!Frm_FindTitles_BOOKS!SPrice AS Expr3,
Forms!Frm_FindTitles_BOOKS!CBPrice AS Expr4,
Forms!Frm_FindTitles_BOOKS!TBPrice AS Expr5;

Thanks in advance.
 
A

Albert D. Kallal

Hum, let me make sure I understand. I assume that the sub-form is now
displaying several records, and you want to navigate to a particular record,
and then do something with it (in your case append it to another table). A
great way to handle this is to put a button on the detail line of the
sub-form. I
have some screen shots of this here:

http://www.members.shaw.ca/AlbertKallal/Search/index.html

And, I got a few more here:

http://www.members.shaw.ca/AlbertKallal/Articles/Grid.htm

So, a user could simply use the up/down arrow keys to move to a record, and
then simply whack the enter key, or double click on the detail line, or
press the button..and the code would append this single record to the other
table.

And, if the user has to select 3, or 4 or 5, and THEN run the append query,
I have a nice working example that shows you how to use a un-bound check box
in a continues form. You can find that here:

http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
I know how to build an append query based on a form controls etc. so
have done that ok.

No, you don't need to somehow "select" the 6 fields...you ONLY need the ID
(primary key) of this record. So, make sure that the primary key ID is
included in the sub-form records (you don't need to display the primary
key..but you need it in the data.
2. How to use the record row in an append query. Would the code look like:

The code would look like:

strMyID = me!id

strSql = "INSERT INTO [Tbl_SBuy Temp] " & _
"( Title, Format, SPrice, BCPrice, BTPrice )" & _
" SELECT Title, Format, SPrice, BCPrice, BTPrice " & _
" FROM tblThatSubFormIsBasedOn " & _
" WHERE ID = " & strMyID

currentdb.execute strSql

If you are using my multi-select example, then you can use something like
id in (3,54,334), eg:

" WHERE ID in(" & strMyID & ")"
 

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