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
 Transact-SQL (2000)
 Looking to turn VBA loop into SQL function

Author  Topic 

mxfrail
Yak Posting Veteran

84 Posts

Posted - 2010-03-08 : 14:14:15
[code]
Set rst = db.OpenRecordset("SELECT tblContracts.ClientID, tblContractDetail.InHomeDate, Left([area],2) AS Expr1 FROM tblContractDetail INNER JOIN tblContracts ON tblContractDetail.ContractID = tblContracts.ContractID where tblcontracts.clientid =" & ClientID & " and tblcontractdetail.inhomedate=#" & InhomeDate & "# GROUP BY tblContracts.ClientID, tblContractDetail.InHomeDate, Left([area],2);")

While Not rst.EOF
MyString = MyString & rst!expr1
MyString = MyString & ", "
rst.MoveNext
Wend
[/code]

In a nut shell I pass in to parameters and I need to return a string of text it creates as it loops.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-09 : 01:26:07
It is better you do it in VBA itself. Why do you want to convert to a SQL Server function?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

mxfrail
Yak Posting Veteran

84 Posts

Posted - 2010-03-09 : 09:33:02
I was hoping to move it from Access over to SQL server.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-09 : 09:35:34
quote:
Originally posted by mxfrail

I was hoping to move it from Access over to SQL server.


Then what would be the front end application?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -