Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 2 Visual Basic Questions

Author  Topic 

Pezamystik
Starting Member

8 Posts

Posted - 2001-01-13 : 14:10:04
I have created a SQL Server 6.5 database and am designing a front-end using MS Access 97. One problem I am having is stripping the character string that builds the Access pass-through query. (Is there an easier way to invoke an SP on the server????) Here is the code I have so far.

Code for button on Access form:
Private Sub Invoke_SP_Click()
On Error GoTo Err_Invoke_SP_Click

Dim DB As Database
Dim Query As QueryDef

Set DB = CurrentDb
Set Query = DB.QueryDefs("q_Query")
Query.SQL = "Stored_Procedure '" & Combo0 & "', & '" & Combo1 & "'"
DoCmd.OpenQuery ("q_Query")

Exit_Invoke_SP_Click:
Exit Sub

Err_Invoke_SP_Click:
MsgBox Err.Description
Resume Exit_Invoke_SP_Click

End Sub

What I need to do is strip the character string of any trailing commas-if a combo box is null. I would like to do this with a WHILE loop. I know that I should need this much.

WHILE RIGHT(Query.SQL, 1)=","

But what is the syntax to shorten the length of the string by 1 char? I also know it might involve the LEN function.

The other VB question is this- Is it possible to return the SQL Server error to the Access form? Or is this only possible when running the pass-through query directly?

I am using SQL Server 6.5, Access 97, Window NT Workstation and Server 4.0.

As always all help is appreciated. Have a groovy day!!!
   

- Advertisement -