Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Monday, August 18, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Issue with SQL
NebSeb
Posts: 49
 
Issue with SQLYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Jan 08 11:29 AM
I know that I cannot call a stored procedure from SLX, or at least I dont know how to do it, so I am trying to just have it run the SQL from inside SLX upon pressing a button on the form.

I get the following error though:
ActiveX component can't create Object: ADOBD.RecordSet

It happens the second time i am calling the

Set objRS = CreateObject("ADODB.Recordset")

Help???

Sub Button1Click(Sender)

Dim strQ
Dim strC
Dim oShell
Dim tAccountID
Dim tCreateUser
Dim tModifyUser
Dim strSQL
Dim objRS
Dim tUserID


tUserID = application.basicfunctions.CurrentUserID

'This finds the current ContactID's that are not in the letter sent table and inserts them
Set objRS = CreateObject("ADODB.Recordset")

strSQL ="INSERT INTO LETTERSENT (CONTACTID, CREATEUSER, CREATEDATE, LETTERSENT) "_
& "SELECT DISTINCT CONTACT.CONTACTID, ' " &tUserID& "', getutcdate(), '0' "_
& "FROM sysdba.CONTACT "_
& "INNER JOIN HISTORY ON CONTACT.CONTACTID = HISTORY.CONTACTID "_
& "INNER JOIN PROSPECTINGGRADES ON CONTACT.ACCOUNTID = PROSPECTINGGRADES.ACCOUNTID "_
& "INNER JOIN USERINFO ON CONTACT.ACCOUNTMANAGERID = USERINFO.USERID "_
& "WHERE (PROSPECTINGGRADES.GRADE = 'a' OR PROSPECTINGGRADES.GRADE = 'a1') "_
& "AND CONTACT.CONTACTID NOT IN (SELECT CONTACTID FROM LETTERSENT)"

objRS.Open strSQL, Application.GetNewConnection


UpdateQuery()

End Sub


Sub UpdateQuery()

Dim strSQL
Dim objRS
Dim tUserID

tUserID = application.basicfunctions.CurrentUserID

'This sets the letterSetn bit for all contacts we have sent a letter to.

Set objRS = CreateObject("ADOBD.RecordSet")

strSQL = "UPDATE LETTERSENT"_
& "SET LETTERSENT = '1', MODIFYUSER = '" & tUserID & "', MODIFYDATE = getutcdate()"_
& "FROM LETTERSENT INNER JOIN"_
& "HISTORY ON ETTERSENT.CONTACTID = HISTORY.CONTACTID INNER JOIN"_
& "PROSPECTINGGRADES ON HISTORY.ACCOUNTID = PROSPECTINGGRADES.ACCOUNTID"_
& "WHERE (sysdba.PROSPECTINGGRADES.GRADE = 'a' OR PROSPECTINGGRADES.GRADE = 'a1')"_
& "AND (HISTORY.TYPE = 262153)"_
& "AND (HISTORY.DESCRIPTION LIKE 'CA Intro Letter%') AND LetterSent.LetterSent <> '1'"

objRS.Open strSQL, Application.GetNewConnection

End Sub
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Issue with SQLYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Jan 08 11:44 AM
I don't know if this was just a typo in putting the code in the post, but you have:

Set objRS = CreateObject("ADOBD.RecordSet")


Notice the mistyped "ADOBD", this should be "ADODB". This seems to be what your error is indicating.

-Ryan
[Reply][Quote]
NebSeb
Posts: 49
 
Re: Issue with SQLYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Jan 08 11:56 AM
I am getting a failed to parse on this query:


strSQL = "UPDATE LETTERSENT"_
& "SET LETTERSENT = '1', MODIFYUSER = '" & tUserID & "', MODIFYDATE = getutcdate()"_
& "FROM LETTERSENT INNER JOIN"_
& "HISTORY ON ETTERSENT.CONTACTID = HISTORY.CONTACTID INNER JOIN"_
& "PROSPECTINGGRADES ON HISTORY.ACCOUNTID = PROSPECTINGGRADES.ACCOUNTID"_
& "WHERE (sysdba.PROSPECTINGGRADES.GRADE = 'a' OR PROSPECTINGGRADES.GRADE = 'a1')"_
& "AND (HISTORY.TYPE = 262153)"_
& "AND (HISTORY.DESCRIPTION LIKE 'CA Intro Letter%') AND LetterSent.LetterSent <> '1'"


Would I be better off trying to call it from a stored procedure, and if so how would i call the procedure. I dont need it to return any date, just execute the update.

Thank You,
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Issue with SQLYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Jan 08 12:02 PM
The SLX Provider doesn't handle most UPDATE FROM type of statements, so that could be it - if that is the case you'll have to rethink how to do your update. Also, some of the lines don't have a space at the end, so you'll end up with things like "FIELD1 = 'a1')AND" which it will choke on as well.

Also to point out, this would likely not sync to remotes since you have a date inline tha is not an ISO formatted date.

Stored procs are not recommended for SLX if you have remotes. The data modified in the proc will *not* sync to remotes.

-Ryan
[Reply][Quote]
NebSeb
Posts: 49
 
Re: Issue with SQLYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Jan 08 12:03 PM
Yeah our office doesnt do remotes.
[Reply][Quote]
NebSeb
Posts: 49
 
Re: Issue with SQLYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Jan 08 12:07 PM
I made sure i had spaces at the end of every line and it was doing the same thing.
IS there a good reference as to how I would call a stored procedure that doesnt return any date, and passes the userid variable to the procedure?

Thank you.
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Issue with SQLYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Jan 08 12:23 PM
Not really a SLX specific topic, a google search on calling stored procs from ADO should give you many examples: http://www.google.com/search?hl=en&q=call+stored+procedure+ADO

-Ryan
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 8/18/2025 3:37:50 PM