T
terry
With the help of Rick Brandt, Dan Artuso, and John Vinson through a previous
post I wrote this function to loop through a table... But I am getting an
error message that my table name is spelled incorrectly and cannot be found.
I may have trouble because all the table names in this database have many
spaces in them... so if you can help me one more time (probably more)....
heree is the function I wrote
The table name is correctly spelled because I copied and pasted it into the
code... Also I tried it with quotes around the table name and also without
the table! in front of the name, but the name still in brackets.
Function CalcAuth(clientid) As Double
Dim calchours As Double
Dim rsa As Recordset
Dim rsp As Recordset
Dim strSqlA As String
Dim strSqlP As String
strSqlA = "Select * From table![CC PCS Authorized Units] Where [au-fk
client id] = clientid"
strSqlP = "Select * from table![CC Procedure Codes] where [proc-pk proc
id] = ra![AU-FK Proc ID]"
Set rsa = CurrentDb.OpenRecordset(strSql)
Set rsp = CurrentDb.OpenRecordset(strSqlP)
Do While Not rs.EOF
If rsa![AU To Date] >= Now() Then
rsp.Requery
calchours = calchours + (rsa![AU Authorized Units] / rsp![Proc
Unit Multiplier])
End If
rsa.MoveNext
Loop
Set rsa = Nothing
Set rsp = Nothing
CalcAuth = calchours
End Function
post I wrote this function to loop through a table... But I am getting an
error message that my table name is spelled incorrectly and cannot be found.
I may have trouble because all the table names in this database have many
spaces in them... so if you can help me one more time (probably more)....
heree is the function I wrote
The table name is correctly spelled because I copied and pasted it into the
code... Also I tried it with quotes around the table name and also without
the table! in front of the name, but the name still in brackets.
Function CalcAuth(clientid) As Double
Dim calchours As Double
Dim rsa As Recordset
Dim rsp As Recordset
Dim strSqlA As String
Dim strSqlP As String
strSqlA = "Select * From table![CC PCS Authorized Units] Where [au-fk
client id] = clientid"
strSqlP = "Select * from table![CC Procedure Codes] where [proc-pk proc
id] = ra![AU-FK Proc ID]"
Set rsa = CurrentDb.OpenRecordset(strSql)
Set rsp = CurrentDb.OpenRecordset(strSqlP)
Do While Not rs.EOF
If rsa![AU To Date] >= Now() Then
rsp.Requery
calchours = calchours + (rsa![AU Authorized Units] / rsp![Proc
Unit Multiplier])
End If
rsa.MoveNext
Loop
Set rsa = Nothing
Set rsp = Nothing
CalcAuth = calchours
End Function