Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...It's extraordinarily refreshing to see truly expert advice without having to wade through hipper than thou attitude..."

Geography

Where in the world do Tek-Tips members come from?

Howto change x number of found records from database at the same timeHelpful Member!(2) 

Nikosis (Programmer)
23 Sep 10 6:24
Hello

Lets say I want to print a list of friends addresses filtered by a city. So out of 100 records I've found "n" records of people living in a given city. It prints out just fine, but after that I have to go and mark checkbox as "printed" for each one of these records manually,
Is there a way to mark them all as "printed" by the time I hit print button.

Thx
Andy
2ffat (Programmer)
23 Sep 10 8:23
What database are you using? Also, what components are you using?
 

James P. Cottingham
I'm number 1,229!
I'm number 1,229!

Helpful Member!  Prattaratt (TechnicalUser)
23 Sep 10 10:38
Since you are filtering records from a Database, I am going to assume you are doing so using SQL queries.  You can create an update query to update all the records you have filtered, and run the query immmediately after printing, or even as a part of the printing process.  The following SQL code can be used to conduct an update similar to what you want

CODE

UPDATE Friends SET Printed = true
WHERE City IS "SomeCity"
Nikosis (Programmer)
23 Sep 10 15:31
Yes, I'm using .mdb ADO SQL queries.
I'm gonna try that right now.

Thx
Andy
Helpful Member!  smays (Programmer)
23 Sep 10 18:14
Try:

CODE

UPDATE Friends SET Printed = true
WHERE City IS 'SomeCity'

(Replace the double quotations " " " with single quotations " ' ")


I was wondering whether the Access SQL engine supports the 'IS' keyword.  Obviously the Access SQL engine does indeed support the 'IS' keyword.  To determine that, I came across the following website:

http://sqlserver2000.databases.aspfaq.com/what-are-reserved-access-odbc-and-sql-server-keywords.html


Steve.
Nikosis (Programmer)
24 Sep 10 0:27
So far I can't get it to work, problem is that I search in 3 different fields, so it is difficult to determine what is used as a parameter to search in the database, on top of it, my search button opens up another window with preview and all kinds of format verifications, zooms, etc..., so from there I can actually print the page. I will try again, to make it work, but out of curiosity is there any other way to do it, lets say with record count and from there go from one row to the next one ?

Thx
Andy
2ffat (Programmer)
24 Sep 10 7:54
Can you show us the SQL statement you use to select/filter on?
 

James P. Cottingham
I'm number 1,229!
I'm number 1,229!

Nikosis (Programmer)
24 Sep 10 17:18
These are my statements

CODE

SELECT * FROM Event WHERE StatusComplete='F' AND LastNameID LIKE :param ORDER BY StartDate ASC
SELECT * FROM Event WHERE StatusComplete='F' AND CityID LIKE :param ORDER BY StartDate ASC
SELECT * FROM Event WHERE StatusComplete='F' AND StateID LIKE :param ORDER BY StartDate ASC
smays (Programmer)
28 Sep 10 13:31
You show three SQL statements, which puzzles me.  Does your program react to the data from each query individually one at a time?  


Assuming you need to UPDATE the database *when* StatusComplete='F' AND LastNameID LIKE :param AND CityID LIKE :param AND StateID LIKE :param then the following is basically how your UPDATE query needs to read:

CODE

UPDATE Event

SET StatusComplete = 'T'

WHERE StatusComplete='F' AND
LastNameID LIKE :param AND
CityID LIKE :param AND
StateID LIKE :param


By the way, are you *really* wanting to update the database?  Or are you wanting to simply update something on the main form?  For example, say you have your list of friends in a TCheckListBox and you have a TButton assigned to send to a printer the data associated with each friend one at a time.  Perhaps you are wanting checks to appear to the left of each friend's name as the friend's data is printed.  Is this what you are wanting to do?

Steve.
Nikosis (Programmer)
30 Sep 10 5:00
Yes it does.
I'm not looking in 3 diff fields at the same time, it's a radiobutton choice. After I hit print it opens up another window with previews, for the last check, and from that point button "ok" prints the page, and updates database hopefully, but radiobuttons are not there so I can't use "if", how can I determine what sql command was used, in order to update only these fields that are printed out.  
Prattaratt (TechnicalUser)
30 Sep 10 12:30
As long as the form is still open, you can still access the controls on it by way of:  Application.Forms("FormName").Controls("ControlName").  If you close it out during opening of the Preview window, then don't until after you have updated the DB.  If you are printing from a report or form, you can use the Record Source property to get the the SQL statement if you used a direct query, or the Query Name if you used a Saved query.  If you used a saved Query, you then use CurrentDB.QueryDefs("QueryName").SQL to get the SQL statement.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close