1 Replies - 2434 Views - Last Post: 14 December 2013 - 06:04 AM Rate Topic: -----

#1 143Dongwoon  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 08-December 13

Printig selected record in data report vb 6

Posted 14 December 2013 - 05:22 AM

can someone help me?. I'm having a trouble displaying filter records in data report. I'm trying to print the selected records by date using filter,but when I print it, all the data in database are display instead of the selected records. Can someone help me.thank you. Here is my code


DataEnvironment1.rsCommand1.Open "select * from patients where ID & Lastname & Givenname & DateNow = ''"
DataReport4.Refresh
DataReport4.Show
DataEnvironment1.rsCommand1.Close



Is This A Good Question/Topic? 0
  • +

Replies To: Printig selected record in data report vb 6

#2 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3822
  • View blog
  • Posts: 13,544
  • Joined: 12-December 12

Re: Printig selected record in data report vb 6

Posted 14 December 2013 - 06:04 AM

"select * from patients where ID & Lastname & Givenname & DateNow = ''"

This is incorrect sql. Sql doesn't use the ampersand & for concatenation. In many sql dialects, '+' is used.

Your statement also assumes that these are all text-fields, containing the empty string ''. You would do better to check each of the four fields individually, some of which may be NULL (I assume).

This post has been edited by andrewsw: 14 December 2013 - 06:09 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1