this should be quick

T

T Best

i'm opening up a recordset using the following code. it's an Aggregate
query. how do i call
the resultant value? The SQL code runs ok, i don't get any errors.

Dim TotalPaidIndem
Dim dbs As Database
Dim rst As Recordset
Dim strClaims As String

Set dbs = CurrentDb

strClaims = "SELECT Sum(RCADET.[11#_PD-IND]) AS [SumOf11#_PD-IND] " & _
"FROM RCACMB INNER JOIN RCADET ON RCACMB.[1#_CLM#] =
RCADET.[1#_CLM#] " & _
"WHERE (((RCACMB.[1#_CLM#]) Like 'SN*' Or (RCACMB.[1#_CLM#])
Like 'NS*') AND ((RCADET.[10#_DT-OS-]) Between #" &
[Forms]![frmClaimsReportRunner]![txtDtTransStart] & "# And #" &
[Forms]![frmClaimsReportRunner]![txtDtTransEnd] & "#));"

Set rst = dbs.OpenRecordset(strClaims)

i was trying...
TotalPaidIndem = rst.[SumOf11#_PD-IND]

and
TotalPaidIndem = rst.value

but kept getting Method or data member not found.

what am i doing wrong?
TIA
Ted
 
S

SteveS

Try using the bang (!) after rst instead of dot (.)

TotalPaidIndem = rst![SumOf11#_PD-IND]

HTH
 
S

Steve Schapel

Ted,

By the way, as an aside, it is not a good idea to use a # or a - as part
of the name of a field or control or database object. I would recommend
changing these if you can, and certainly avoid this practice in future.
 
T

T Best

i couldn't agree more. it was like that when i got here. there are so many
queries and reports based on these field names. it would be an absolute
nightmare to change them. maybe one of these days...

thanks so much for the help...that worked. i knew it was something stupid

Steve Schapel said:
Ted,

By the way, as an aside, it is not a good idea to use a # or a - as part
of the name of a field or control or database object. I would recommend
changing these if you can, and certainly avoid this practice in future.

--
Steve Schapel, Microsoft Access MVP
Try using the bang (!) after rst instead of dot (.)

TotalPaidIndem = rst![SumOf11#_PD-IND]

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top