-
How to check if the record exists in the current ado recordset?
Hi All,
I want to check if the record exists in the ado recordset or not. I tried
to use the ado.seek function, but it is not work well for me. Can any one
give me a suggestion?
Thanks,
Ken
-
Re: How to check if the record exists in the current ado recordset?
"Ken" <kenchk@sympatico.ca> wrote:
>
>Hi All,
>I want to check if the record exists in the ado recordset or not. I tried
>to use the ado.seek function, but it is not work well for me. Can any one
>give me a suggestion?
>
>
>Thanks,
>Ken
'**************************************
This isn't the greatest way but it works.
dim the variables you have to use.
After you open the connection to the databse do this. You might have to
open the connection twice. Close the first before opening the second.
Hope this helps.
'******************************************************
'*** Check to see how many exist with current info. ***
'******************************************************
sSql = "SELECT * FROM Table "
sSql = sSql & "WHERE RecordType = '" & txtbox.Text & "' "
sSql = sSql & "AND Account = '" & txtbox.Text & "' "
sSql = sSql & "AND Cusip = '" & txtbox.Text & "' "
sSql = sSql & "AND TransCode = '" & txtbox.Text & "'"
rs.Open sSql, Conn, adOpenKeyset, adLockPessimistic
'***************************************************************
'*** This will Count how many record fit the criteria above. ***
'***************************************************************
Do While Not rs.EOF
iCount = iCount + 1
rs.MoveNext
Loop
-
Re: How to check if the record exists in the current ado recordset?
Thanks,
Ken
"Jim" <jcb1269@excite.com> wrote:
>
>"Ken" <kenchk@sympatico.ca> wrote:
>>
>>Hi All,
>>I want to check if the record exists in the ado recordset or not. I tried
>>to use the ado.seek function, but it is not work well for me. Can any one
>>give me a suggestion?
>>
>>
>>Thanks,
>>Ken
>
>'**************************************
>This isn't the greatest way but it works.
>
>dim the variables you have to use.
>
>After you open the connection to the databse do this. You might have to
>open the connection twice. Close the first before opening the second.
>Hope this helps.
>
>'******************************************************
>'*** Check to see how many exist with current info. ***
>'******************************************************
>sSql = "SELECT * FROM Table "
>sSql = sSql & "WHERE RecordType = '" & txtbox.Text & "' "
>sSql = sSql & "AND Account = '" & txtbox.Text & "' "
>sSql = sSql & "AND Cusip = '" & txtbox.Text & "' "
>sSql = sSql & "AND TransCode = '" & txtbox.Text & "'"
>
>rs.Open sSql, Conn, adOpenKeyset, adLockPessimistic
>
>'***************************************************************
>'*** This will Count how many record fit the criteria above. ***
>'***************************************************************
>Do While Not rs.EOF
>
> iCount = iCount + 1
> rs.MoveNext
>
>Loop
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|