Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset not updating

Status
Not open for further replies.

tonioJ

Programmer
Oct 7, 2002
90
PH
Can anybody help me with this problem?
I created a static recordset. When I load a form, I populated the static recordset(rs). All goes well, I was able to add a record in the static recordset. As part of processing, the records in the static recordset are filtered according to certain criteria.

So now, here is the problem. After filtering the static recordset, when I add a record using the statement
below:
rs.addnew
rs![ref_no] = "string VALUE"
.
.
rs![CONVERSION] = 343.00
rs.update

the recordset is not updated. It doesn't add any record in the recordset. What seems to be wrong????

Please help, it's an urgent problem that I need to solve. because part of the module of my project doesn't work.

Below is my source code for creating the static recordset:
Set rs = New ADODB.Recordset
With rs
.Fields.Append "REF_NO", adChar, 10
.Fields.Append "PRSQM", adCurrency
.Fields.Append "LBPPRSQM", adCurrency
.Fields.Append "COMMISSION", adCurrency
.Fields.Append "DISTURBANCE", adCurrency
.Fields.Append "TAXES_EXP", adCurrency
.Fields.Append "OTHERS", adCurrency
.Fields.Append "TOTPRSQM", adCurrency
.Fields.Append "CONVERSION", adCurrency
.CursorType = adOpenKeyset
.LockType = adLockPessimistic
.Open
End With

Below is the code for filtering the data in the recordset:
rs.Filter = "REF_NO = '" & filtervalue & "'"

 
Shooting from the hip. . . I would say it is actually being added but the filter may be making it look like its not there. In order for me to know for sure one would need to know the value of the <filtervalue> variable. Would also need to know what the actual value for is <string VALUE>.

The line
rs![ref_no] = &quot;string VALUE&quot;

Creates a run time error due to <string VALUE> being longer than 10 characters
 
hello.. thanks for the reply

on the line:
rs![ref_no] = &quot;string VALUE&quot;

i used string &quot;value VALUE&quot; just to show the value passed on the rs![REF] is string.

Also, I got your point that the filter is filtering my data. That is why I couldn't if the recordset is added.. I will try to look into value of filter. Thanks Ron!


 
This is your problem:

rs.update

Change it to

rs.updatebatch

The filter command only works on records affected since the last UpdateBatch [/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Hello Guys, thanks for all your help. I have resolved the problem. It's just the filtering of record that affects the data in the recordset... Thanks a lot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top