selecting multiple records

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

Guest

I have a form which displays all records in tabular form. I would like to select multiple record (not in serial) and then after selecting these records would like to run a report. I can select multiple record through a query(via a form), but I have not idea how I can select records by "pick and choose" way. I have seen programs in which you press F5 or another key to select and deselect records. I have no idea how to do this in access 2003?
 
You can only select contiguous records in a continuous form or datasheet.

To select individual records, add a Yes/No field (named "IsPicked" in this
example) to your table, so the user can check the box for the records they
want. To reset them again:
dbEngine(0)(0).Execute "UPDATE MyTable SET IsPicked = False WHERE
IsPicked = True;", dbFailOnError

If you are in a multi-user environment where that is not appropriate, create
a table in the front end database to store just the primary key value of the
records that the user wants, and then base your report on a query that joins
the temp. table to the real one.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Avir said:
I have a form which displays all records in tabular form. I would like to
select multiple record (not in serial) and then after selecting these
records would like to run a report. I can select multiple record through a
query(via a form), but I have not idea how I can select records by "pick and
choose" way. I have seen programs in which you press F5 or another key to
select and deselect records. I have no idea how to do this in access 2003?
 
Thanks Alle
I am amazed at your speedy and accurate reply
Since i am a begginer could you please specify where I should put the following command

"dbEngine(0)(0).Execute "UPDATE MyTable SET IsPicked = False WHER
IsPicked = True;", dbFailOnError"

Should I put it as a macro in Run Comman window?

I have tried your way and it is working fine!! i just need to deselct the records after I print my report.

Many thanks
 
1. Put a command button on your form.

2. Set its On Click property to:
[Event Procedure]

3. Click the Build button (...) beside this.
Access opens the code window.

4. Place the line of code between the "Private Sub ..." and "End Sub" lines.
(Note that it is all one line.)

It would be a good idea to save any changes on your form first, so the code
would end up like this:

Private Sub cmdReset_Click()
Dim strSql As String
If Me.Dirty Then
Me.Dirty = False
End If
strSql = "UPDATE MyTable SET IsPicked = False WHERE IsPicked = True;"
dbEngine(0)(0).Execute strSql, dbFailOnError
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Avir said:
Thanks Allen
I am amazed at your speedy and accurate reply.
Since i am a begginer could you please specify where I should put the following command.

"dbEngine(0)(0).Execute "UPDATE MyTable SET IsPicked = False WHERE
IsPicked = True;", dbFailOnError"

Should I put it as a macro in Run Comman window?

I have tried your way and it is working fine!! i just need to deselct the
records after I print my report.
 
Back
Top