View Single Post
  #2 (permalink)  
Old July 15th, 2015, 07:28 PM
mat41 mat41 is offline
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

I dont understand what your issue is. You have not been clear at all. This said, yes there is a problem in your SQL. It just cant be running like this, surely it give you a run-time error? You must use & and not + to concatenate.

Also, Avoid using reserved words for field names, this is such a bad habit. If you must, surround the word with []. Its a good practice to use a trailing semi colon for all SQL. Change you code to this:

NOte : If 'TYPE_USER' is an integer get rid of the surrounding single quotes. The code below assumes this field is a string

Code:
rsTypesGallery.Source = "SELECT TOP 20 * FROM [TYPES], PICTURES WHERE TYPE_USER = '" & Replace(rsTypesGallery__MMColParam, "'", "''") & "' AND TYPE_ID = PIC_TYPE ORDER BY TYPE_DATED DESC;"
__________________
Wind is your friend
Matt

Last edited by mat41; July 15th, 2015 at 07:31 PM..