Re: ADO Find Help?
- From: "Steve Byrne" <steveb@xxxxxxxxxx>
- Date: Fri, 9 Sep 2005 10:04:27 -0400
The difference is when you do an add new, there are no other records that
meet the filter, so only one record gets updated. You need some other unique
record identifier to locate the exact row you want to update (via the .Find
method), then update the value in the recordset (I'm not familiar with what
the '!' syntax does). Once the single record is found, you should be able to
update that row in the recordset (rs("ColumnName") = valueX) and issue the
..Update and it only updates that single record...
Hope this helps.
<greg4168@xxxxxxxxx> wrote in message
news:1126186002.856192.70570@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hi, I'm new to ADO and am hoping somebody here can steer me in the
> right direction.
>
> I'm using VB6, and an SQL database. I simply want to search the
> database for a record containing two key values. For example, I want
> to find a record where column A = xx, and column B = yy. I'm using
> .Filter to do this, and believe I have it correct. Here's my filter
> statement: .Filter = ("dbcolA = '" & valueA & "' and dbcolB = '" &
> valueB & "'"). The result of this statement comes out to "dbcolA =
> 'valueA' and dbcolB = 'valueB'"
>
> The next part I'm doing is either adding a new record to the table, or
> updating the existing record, based on the result of the filter. The
> way I'm doing this is as so:
> If .EOF Then
> .AddNew
> End If
> !dbcolA = valueA
> !dbcolB = valueB
> .Update
> .Close
> .Filter = adFilterNone
>
> So, the only difference between a new record and an updated record is
> the .AddNew statement.
>
> The result of this is that when valueB changes, a new record is added
> to the table as expected, but the valueB is propogated across all
> records that contain valueA. I want it to create a new record, but not
> touch any of the existing records.
>
> What am I doing wrong??
>
> Thanks very much...
>
.
- Follow-Ups:
- Re: ADO Find Help?
- From: greg4168@xxxxxxxxx
- Re: ADO Find Help?
- References:
- ADO Find Help?
- From: greg4168@xxxxxxxxx
- ADO Find Help?
- Prev by Date: help with microsoft ADO control/True DB Grid
- Next by Date: Re: help with microsoft ADO control/True DB Grid
- Previous by thread: ADO Find Help?
- Next by thread: Re: ADO Find Help?
- Index(es):
Relevant Pages
|
|