Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Anpu Massri   on Jan 31 In MS Office Category.

  
Question Answered By: Bonifaco Garcia   on Jan 31

This is a good question.



Your problem is not with your SQL, although there may be a problem there
also.



The problem is in this line of code:

rsData.Open sSQL, sConnect, 3, 1

You must use gcnAccess, not sConnect, like this:

rsData.Open sSQL, gcnAccess, 3, 1



You can also make sure after using gcnAccess.Open that it worked ok, that
is, that the connection  is now open, in the debugger while stepping through,
that gcnAccess.State = 1 (adStateOpen). If it is not, then the connection is
not open.



In your SQL, make sure you have a space in the string between words,
sometimes it can get confusing. For example, in your code:

sSQL = "SELECT [Report Category],[PQR Number],[Create-date]" & _

"FROM [Closed Remedy PQR] WHERE [Closed Remedy PQR].[Create-Date] > Date()-8
And [Closed

Remedy PQR].[Report Category] <> " & StrSearchtxt & ";"



There is no space before the word FROM, so the SQL looks like:

"SELECT ...[Create-date]FROM [Closed..." and you can see the FROM needs a
space before it.



But your main problem is the rsData.Open statement.

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 


Tagged: