Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Edit Record Using ADODC Or ADO


Hi,Is it possible to edit a particular record using ADODC or ADO.I tried edit method.It is not working.Can u tell a soliution?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
.edit Adds New Updated Record Instead Of Saving Changes To Existing Record
hey everyone,

i'm creating an interface for an Access database using DAO, and one of my options is to edit a record. the code i'm using is recordset.edit ...then the textbox names that the record the user is editing is being displayed in..then the recordset.update. when i run the program, edit a record and save it, it creates another identical record just with the changes that i made to it. so i have the original record plus a new updated record in my database. any ideas how i could get it to just save the changes to the existing record? Also another quick question...is there any kind of code that maximizes the forms everytime you run the program?

i would appreciate any help, thanks

Edit Using Adodc
hii, i'm new here..
how to edit the record i choose on datagrid? what happen now, it always edit the first record even i choose the third record on the datagrid..
it's not like delete (delete will remove the record on where my pointer point to)
why? and how? thank you

How Can I Add,edit In Multiple Tables With Adodc/ado
Hi everybody,

Please help me to know that how can i add/delete/edit/update with multiple tables in access 2000. I'm using ADO data control,ADO. It's urgent. Please attach source code of any example program, if possible.

THANKS

Regards,
EmmanuelJKM

Need Help Bout NEW,ADD,DELETE, EDIT Using Adodc
Please help how to use this commands in adodc NEW, ADD, SAVE, DELETE, EDIT, I hope you appreciate my help.

Question About Using Mask Edit Control, Access And Adodc
I want to use the mask box with Adodc. And the data wil be saved in Access. I was wondering if someone can point me to a good site where I may be able to find some information about doing this.

Any help will be appreciated.

ADODC Add New Record HELP
i write program to connect to (C:Adresyadresy.DBF) file and add new record and in field name "NR" write FER (data) how to make this in VB6 ?

i write

Adodc1.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=adresy;Mode=Read/Write;Initial Catalog=C:Adresy"
Adodc1.RecordSource = "adresy"
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("NR") = FER
Adodc1.Recordset.Update
Adodc1.Recordset.Close
MsgBox "zarejestrowano"

(FER) it's from another data

When i run the program VB6 give me a Error "Object required or with block required not found" and highlight "Adodc1.Recordset.AddNew" line why ?

Adding A Record To An ADODC
I have a problem with an ADODC in Visual Basic 6.

I have an ADODC which is displayed using a DataGrid control. I use the AddItem method of the ADODC.Recordset in order to add a new record and then the Update method of the ADODC.Recordset in order to perform an update to the data base (MS-Access). The problem is that the new record is added at the end of the table, but the ADODC.Recordset is sorted - so the new record is not displayed on it's right place.

What can I do to fix this so that the new record will be displayed on it's right place according to the sorting order and not at the end of the table as the last record ?

How To Get Record Number With An ADODC
Using an ADODC how do you display the current record number? I already have the total number of records using Adodc1.Recordset.RecordCount, but I would like to show the current record number as the movenext and moveprevious buttons are used, i.e. "Record 25 of 250"

ADODC Delete Record
I created an address book utilizing an adodc contol....

when the user clicks a button that says delete, I want the user to be able to delete the record that they are currently viewing on the form from the database...

Problem is, I don't know how to do this. Does anyone know how to do this? I have tried adodc1.recordset.delete but it crashes the program... therefore I am probably doing something wrong.

Adodc Record Transferring????
ive created an application where i have four tables in my databases..upon form load, i want to display all the records in my form, so the user will be able to see the typographical error's in each fields, even those fields with repeatable records..

can i just use the adodc.recordsource property to transfer the records contain from one table to another...??

ive tried, but it gives me the error
"Object doesnt support this property or method'...i equate the recordsource of one adodc to another adodc... .....phewww!! i know it's wrong and silly , just want to see if there's a shortcut to it...


VB Code:
Adodc2.ConnectionString = "cdsisis"Adodc2.RecordSource = "select * from tbl_rnd_names where rnd_id like '" & textrnd_id.Caption & "%';"Adodc2.Refresh 'Adodc3.ConnectionString = "cdsisis"Adodc3.RecordSource = "select * from tbl_rnd_temp where rnd_id like '" & textrnd_id.Caption & "%';"Adodc3.Refresh Adodc3.RecordSource = Adodc2


well..maybe i should do it manually??

Searching Record Using Adodc
hello    
    I created a table in MS-Access with fields emp name, ID, designation, department etc. And it had no.of entries.
    I want to retrive information according to our choice by selecting an entry from combo button.
    In combo box, we have multiple options like programmer, analyst, hr, etc.,
    If I select programmer, then i want to display programmers name and ID from the access table into a data grid or flexi grid.
    if u know, show me the code

    kiran chand

Creating New Record In Adodc
hi there...

i'm new in the Adodc control...everything is going fine. but then when i want to create new record in other table using other Adodc..the problem come... . ok..let me explain...

create new record in AdodcCaruman involve create new record in AdoPPP, AdoTunggakan, and AdoPenyata1. This AdoPPP, AdoTunggakan, and AdoPenyata1.
has it own table. so, creating new record in table AdoCaruman will involve other 3 other new record in 3 table.

i'd try so many code and method..but it's not worked.


Code:
   With AdoCaruman
      .Refresh
      .Recordset.AddNew
      .Recordset![noStudent] = txtnoStudent.Text
      .Recordset.UpdateBatch adAffectAllChapters
    End With

     With AdoPPP
      .Refresh
      .Recordset.AddNew
      .Recordset![noStudent] = txtnoStudent.Text
      .Recordset.UpdateBatch
    End With

     With AdoTunggakan
      .Refresh
      .Recordset.AddNew
      .Recordset![noStudent] = txtnoStudent.Text
      .Recordset.UpdateBatch
    End With

     With AdoPenyata1
      .Refresh
      .Recordset.AddNew
      .Recordset![noStudent] = txtnoStudent.Text
      .Recordset.UpdateBatch
    End With



Any idea..guys?

How To Display A Particular Record In A Adodc
I have a two form application. The first displays all tasks, the second displays (or should) a single task, along with all of the details of audit history for that task.

Using the form wizard, I have the second form displaying 'a' task and the details of that task.

My problem, is how do I get the second form to display a particular task (say TASKID = 5), And how to get this form to change and display a different task when directed to from either the controls or from a public method call?

----

Adodc Last Record Loop Twice
Hi,

I'm working with ado data control.
when pressing on the navigator arrow (for seeing last record) , textboxes in the form are being changed therefore the 'text1_change' function is called. but then, and this is the problem - another time this function 'text1_change' is executed although it is EOF.

see my code



Code:
Private Sub Text1_Change(Index As Integer)

Dim rsDepart As New Recordset
Dim sql As String

If AdoStand.Recordset.BOF = False And AdoStand.Recordset.EOF = False Then

Select Case Index

Case 0
If Text1(0).Text <> "" Then
sql = "select name from company where code='" & Text1(0).Text & "';"
rsDepart.Open sql, cn, adOpenForwardOnly, adLockReadOnly
If Not rsDepart.EOF Then
txtDepatName.Text = rsDepart.Fields("name").Value
End If
rsDepart.Close
End If


Case 1
...

End Select

If blngap= True Then
Call gap
End If

Else
Exit Sub
End If 'If AdoTeken.Recordset.BOF = False And AdoTeken.Recordset.EOF =

End Sub



thanks

Ado First Record In Adodc Navigator
how can i check in the code with my AdoStand.Recordset.?? if it is the first record ? what is the method to use ?

thanks

Move Adodc Record With A Datacombo
I have succesfully created a datacombo and two text boxs bound to a adodc control. I can select any record fron the datacombo but the two fields that that the text boxs are bound to, don't change to match the record in the Datacombo. If I use the ADODC control, I can move through the records and all three fields change. I need to know how to have the datacombo move the current record in the ADODC to match the datacombo. Any help is appreciated.
Thanks
Tom

Delete Record Update With Adodc
I am deleting a record from my ss1tab using
adodc1.recordset.delete
but when I delete this record the form does not update itself a record that actually exist whether its previous or the next record. The form only updates when I click on the record pointer adodc1 then it will show that the deletion occured. how can I fix this.

Using ADODC To Search A Record In MS Access
just asking...how do you search for a record in MS Access using ADODC? what i meant is how do you code in such a way that if a record is found it would display the info being searched; otherwise it will inform the user that the record is nowhere to be found in the database.

thanks!

How To Lock Record With ADODC Control
Hi,

I have an application With VB6 and an SQL SERVER 2000 databases. My application is multi-users and i use ADO technology. When a user is editing a records, I lock this record until he update the record.

But i have few pages With ADODC control (Add, Edit, Delete button, and view records in a datagrid). User Can't update or add new records directly in the datagrid. They must Click Add, and type data in textbox. After, he click on SAVE. I want to know how to lock record. I don't want that 2 users Edit the same records

Thanks you

Why Can&"t I Insert(add) A Record To An Adodc?
i am trying to add a record to a database using adodc. it will not work. here is what i have

adodc parameters:

ConnectMode=0
CommandType=8
ConnectStringType=1
Connect=Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Documents and SettingsRaptor31Desktopdlltrialdb1.mdb;Persist Security Info=False OLEDBString=Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Documents and SettingsRaptor31Desktopdlltrialdb1.mdb;Persist Security Info=False
RecordSource="select * from cityinfo"
Caption="db1"

code tryed:

sqlcode = "insert into Table1 values('" & Text1.Text & "','" & Text5.Text & "','" & Text4.Text & "','" & Text3.Text & "','" & Text2.Text & "')"
db1.RecordSource = sqlcode
db1.Refresh

data base fields (all text) with what text box:
lname = text1
fname = text5
dob = text4
gender = text3
state = text2

what do i do

Record Count - ADODC Objects
I am using ADODC Object and Access mdb database.

I need to find how many records in the selected table.
If i am use the recordcount property it returns -1 as result.

any one know how can i find no. of records in the table.
any other idea.

Regards
Ullas

Adodc Adding Record Problem
Hello

I am loading combo boxes on my form load event. I have my combo and text boxes connect to an Adodc control. When I load the form the first record does not appear in the combo boxes. And when I add a record using the command button it only adds a record to the first row. I cannot add to the end of the record. Can some help me with what I am doing wrong.


Code:Private Sub Form_Load()
Set cn = New ADODB.Connection

cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "TSG Database.mdb"
str1 = "Select DISTINCT [SERVICE TYPE], [TECHS] from Options"
Set Rs = cn.Execute(str1)
Do Until Rs.EOF
  
  If Not IsNull(Rs.Fields("TECHS").Value) Then
    Combo1(0).AddItem Rs.Fields("TECHS").Value
  End If
  
  If Not IsNull(Rs.Fields("SERVICE TYPE").Value) Then
    Combo1(1).AddItem Rs.Fields("SERVICE TYPE").Value
  End If

  Rs.MoveNext

  Loop
End Sub


Code:Private Sub cmdSave_Click()

With Adodc1.Recordset
.AddNew
End With

End Sub

Thanks
Bob

ADODC Changing Current Record 'on It's Own'
Hello

    I am using vb6, and have some tabs and adodb recordsets. the plan is, when the user clicks on a datagrid list to change tabs and find the entry clicked on.
    User clicks on 'parents name' in datagrid
    my code collects the 'name' then changes tab to the 'children tab', it then makes a copy of the children recordset, it runs through the copy recordset to find the correct record, then makes a bookmark. Then I change the bookmark of the children recordset to my new bookmark to move it to the correct record. this all works fine and perfect.
    when the routine executes the 'exit sub' command, the children recordset mysteriously changes on it's own, moving away from the correct record. The code immediately goes to the 'move completed' routine and carries on from there., I have ran through the routines step by step, with watches on the main variables. and it all shows the recordset moving on or immediately after 'exit sub'

It is very frustrating to get so near then the thing move on it's own for no apparent reason..

Can anyone please shed some light??


Icarusbop

Delete And Update Record Using ADODC
I can see the database using MSHFlexGrid connected by ADODC. But how can I make query on the database, like insert and delete during run time.

Need Help With Deleteing A Record In Access With Adodc
Can anyone tell me how use a cascading delete in vb with adodc or at least trap the error and inform the user that other associated sections must be deleted first.

Thanks
Ryosuke

ADODC Control Record Movement
Hi,

Using the ADODC control it works fine in vb environment.

If I distrbute the applicaiton and try to use the control.
If initial values are set then it shows them and do not allow any move to other records.

I have checked that connection is open and database is read perfectly. May be I am not including some ocx/dll?? Don't know.

can somebody solve my problem.

Thanks,

AddNew Record W/ Adodc &amp;|| Data Controll
How do you add a new Record into the db table with the Data control and how do you do it with the adodc control
I already have the control(s) on the form and connected to a datagrid to allow the user to edit them but the user needs to be able to add a new record to the db

Using SQL Statements As The Record Source For An ADODC Control.
Hi,
I have created an SQL statement using the DataEnvironment and now I would like to use that statement as the record source for a ADODC control that I have placed on my form. I have set the connection string up and thats ok. I have copied and pasted the sql statement straight from the DataEnvironment Sql statement window in to the ADODC RecordSource Commant Text(Sql)window. The sql statement is as follows:

SELECT `Jkt Schedule 1`.`Mill Order No`, `Jkt Schedule 1`.`Design Desc`, `Jkt Schedule 1`.`Design No`, `work in progress`.`Mill Order No` AS Expr1, `work in progress`.`Cols Made` FROM `work in progress`, `Jkt Schedule 1` WHERE `work in progress`.`Mill Order No` = `Jkt Schedule 1`.`Mill Order No`} AS Command1 APPEND ({SELECT `cloth qty booked`.`order`, `cloth qty booked`.`Cloth Qty Booked`, `Batch Footer`.`Batch no`, `Batch Footer`.`Roll Id`, `cloth qty booked`.`Roll Id` AS Expr1 FROM `Batch Footer`, `cloth qty booked` WHERE `Batch Footer`.`Roll Id` = `cloth qty booked`.`Roll Id`} AS Command2 RELATE 'Mill Order No' TO 'order') AS Command2



I have placed a text box on my form and set the datasource to ADODC1 which is correct but when I try to specify a DataField I get the error message attached (sql error.bmp).

Can you not copy a Sql statement straight from the DataEnvironment designer in to the recordsource or an ADODC data control?


Thanks in advance.

Saltman

If anyone could help I would be very grateful

ADODC &amp; Multi Users (Lock Record)
Hi,

I have an application With VB6 and an SQL SERVER 2000 databases. My application is multi-users and i use ADO technology. When a user is editing a records, I lock this record until he update the record.

But i have few pages With ADODC control (Add, Edit, Delete button, and view records in a datagrid). User Can't update or add new records directly in the datagrid. They must Click Add, and type data in textbox. After, he click on SAVE. I want to know how to lock record. I don't want that 2 users Edit the same records, Or edit a deleted Record.

-------------------------------------------------------------------------

I am able to lock record With ADODB.Recordset

Code:
With AdoRs
.ActiveConnection = ADOConn
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockPessimistic
End With

'When user clic "EDIT", I open the records like that... and if someone else try to open the same records (Program return an error) :

'This is the procedure if a records was deleted or in EDIT

ErrLock:
If Err.Number = 3021 Then
ADOConn.RollbackTrans
MsgBox "Record was deleted by another user.", vbCritical
Exit Sub
Else
If ADOConn.Errors.Item(0).NativeError = 1222 Then ' Lock Timeout
ADOConn.RollbackTrans

MsgBox "Records is locked by another user.",vbCritical

ADOConn.Errors.Clear
Exit Sub
End If
End If

Call ErrHandler(ADOConn)
Resume Next

But, I want to do the same thing with ADODC Control

Help me please .. Thanks you

Deleting A Record From A Child-table (ADODC)
I am trying to create a small simple applikation in VB 6.0 that connects to an Access 2000 database. Everything works, except when im trying to delete a record from a child-table.
I have created a cascade on delete from the parent-table, and it works without any problems.
When a deletebutton is pressed the following function is called:

Function Delete_Snake (dat as ADODC)
Dim YN as Integer
YN = MsgBox ("Warning! Do You really want to delete this record?", vbYesNo+vbCritical,"Warning!")
If YN = 6 Then
dat.Recordset.Delete
End If
End Function

There is no problem deleting a child-record within Access.
Rem. I have 5 ADODC "children" controls on the same form and one master. I dont have any problem in inserting new records to the children...

Please help....

P.S.
Im using textboxes for displaying the attributes (including PK)
D.S.

Delete Record From ADODC But Still Showing On MSHFLEXGRID
Hi,
I have a ADODC control & MSHFLEXGRID in the form. Data source of MSHFLEXGRID is ADODC. when I delete a record from ADODC & refresh. My MSHFLEXGRID still showing the deleted record. Please help.

    Adodc1.Recordset.Delete
    Adodc1.Refresh

Thanks.

How To Delete Duplicate Record In Adodc Recordset
My database has duplicate record. I want to delete one of the record. Both the records have same key.

    adodc.recordset.delete

I use VB code above to delete the record. My problem is, both of the record is deleted. How can I just delete only one of the record ? Anyone can help to solve this problem.

With ADODC How To Show Total Record On A Texbox Or Label
Dear VBCity Member,...

Any body want to help me about Subject Above,....

Form Attached...

Thanks

How Do I Edit A Record Set?
Hi.

How do I edit a already created record set?

ADO Record Edit
I am trying to get an MDB record to update a current record accesssed by and ADO data control. (I'm new to VB so please forgive any incorrect phrases i may use.) I can get the update to take effect in the record. but my problem is that it will not update the field in the current record. All updates will go into the first record in the table.
Here is the code that I am using for the update command. Any suggestions would be helpfull.
PS. I have tried to use the 'myRecordset.Edit' command and it gives me a runtime error and states that the method or data could not be found. I have also tried the 'myRecordset.EditMode' and this results in the same error.

Private Sub CmdUpdate_Click()
myConnection.ConnectionString = Systems
myConnection.Open
With myRecordset
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open "Systems", myConnection, , , adCmdTable
End With

' Add Updates from Update text Field.
myRecordset.Edit
If myConnection.State = adStateOpen And myRecordset.State = adStateOpen Then

myRecordset!Changes = TxtUpdate.Text
myRecordset.Update

MsgBox "Updates Successfully Entered", vbOKOnly, "Updates Added."
Else
MsgBox " An Error has occured in Reporting your Updates!" &amp; vbCrLf &amp; " Please Contact Systems Dept for Assistance!", vbExclamation + vbOKOnly, "Error Report"
End If

myRecordset.Close
myConnection.Close
Set myRecordset = Nothing
Set myConnection = Nothing
End Sub

Edit A Record
Can anyone tell me how to edit a record in access db using ado?

Edit Record
Hey there,

Anyone has any example on how to edit a record in vb.. i have tried edititg a record but the only edit function which i could find is rs.EditMode which cannot be used to edit data...


Anyone knows hot to over come this...

Thanks once again!!

Edit A Record
I want to edit a record in my database (which is indexed having unique
fields). But whenever I do so, it gives error of duplicate values.
But I am using data1.recordset.edit, so I guess it shouldn't give
that error. Please guide me in this. It is urgent.

ADODC Find Record And Return Its Contents To Form Textboxes
I have searched until my brain emmited smoke, but cannot seem to find the correct example structure to go into my database with a textbox entry and retrieve the matching record; then returning the fields to the appropriate textbox's within my Form. I know this is probably easy but I am a noob and just can't seem to pull this one together. This form will be the area in which to edit the data in the recordset and print that data if needed. I believe that I am opening the Recordset, I just can't get it to the textbox's. Any help would be greatly appreciated. The latest snippet is the latest help I recieved but doesn,t seem to work. I get and error on .Find Criteria:=strCriteria, SearchDirection:=adSearchForward.

Error is: Arguments are of wrong type, are out of acceptable range, or are in conflict with one another.

If there is an easier way I am all eyes.

Private Sub cmdRetrieve_Click()
FindRecord "E:My VB FolderCurrent ProjectPurchasing Database_Rev4.mdb", "CORES", " 'txtFields(0).Text' ", " 'txtPartNumber.Text' "
End Sub

Private Sub FindRecord(strDBPath As String, _
strTable As String, _
strCriteria As String, _
strDisplayField As String)
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset

' Open the connection.
Set cnn = New ADODB.Connection
With cnn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open strDBPath
End With

Set rst = New ADODB.Recordset
With rst
' Open the table by using a scrolling Recordset object.
.Open Source:=strTable, _
ActiveConnection:=cnn, _
CursorType:=adOpenKeyset, _
LockType:=adLockOptimistic

' Find the first record that meets the criteria.
.Find Criteria:=strCriteria, SearchDirection:=adSearchForward

' Make sure record was found (not at end of file).
If Not .EOF Then
' Print the first record and all remaining
' records that meet the criteria.
Do While Not .EOF
Debug.Print .Fields(strDisplayField).Value
' Skip the current record and find next match.
.Find Criteria:=strCriteria, SkipRecords:=1
Loop
Else
MsgBox "Record not found"
End If
' Close the Recordset object.
.Close
End With

' Close connection and destroy object variables.
cnn.Close
Set rst = Nothing
Set cnn = Nothing
End Sub

Peace_Dawg

How To Update One Record Value Via Adodc With Msaccess From The Text File Data
i wanted to update one record in msaccess

in that database table have name & number & photo
photo already having binary data and serial number also 1to 50

this name is dinamic so i will type 1 to 50 names in one text file
my program should read that text file and update in that name field (it shloud refer the number field for accending the records)
awaiting for yours answer
ap.velan@gmail.com

ADODC : Determining If A Value In A Record Exists In Similar Fields Of Other Records?
Hi there! On my form, I've a ADO Data Control connected to a database at design time.

How do I determine if the value of a field in one particular record is not duplicated in other records within the same table?
Is there a function which does this for me?
That is, a function that checks the table to see if a value of a particular field of a desired record exists in other records too, and return TRUE if there's duplicated values, FALSE otherwise. Is there?

If not, how do I do it? Please and thanks a lot!

Edit Record Problem
I have a form with a TextBox. This is an input field and is working great. The problem I am having is I have a control on the form to turn this form into an "EDIT" form which then shows the records that I want to edit (I am using ADODC control to navigate through the records to the one I want.

The problem is, when I bring up a record for edit and click in the TextBox, it blanks out the record and rewrites it instead of allowing me to edit the text and add additional text.

Can anyone tell me how to put the record into TRUE edit mode or give me any suggestions about editing existing records.

Thank you,

Jenn

Edit Record Problems
I am trying to edit multiple (5) recordsets simultaneously in one sub routine. All 5 recordsets are opened identically (adlockoptimistic, openkeyset, JetOLEDB 4.0, adcmdtable) and I am using ADO. When I click the command button it gets to the 4th recordset and tells me "the recordset does not support updating, it could be a limitation to the provider or the selected keyset or cursortyope"...BUT it allowed me to update the previous 3 which were opened the exact same way with the exact same properties.

The only difference in the recordsets are that the one not allowing updating is a single recordset...

SQL = (SELECT * FROM Database WHERE Column = Primary ID")
set rs.execute(SQL)

as opposed to...

rs = SELECT * FROM Database"

Any ideas what I need to do?

The only thing I can think of is that I should change first example recordset above to adcmdtext instead since I am executing an SQL statement...maybe that is the problem (wish I was at my computer to give it a try). Anyone know if this will solve the problem?

Edit Record In Recordset
Hello,
I got a recordset that I want to edit a record. The value to insert in a specific field is received from the keyboard.
How can I insert a value in a specific field?

The field is called M_Mail14.

David

Help - Edit Record SQL Command
Hey Guys..Long Time No See,

I am having problems with a SQL statement for editing a field in a lookup table. Here is my table:

Counter | Loc_Code | Location

The field I need to update is the Counter. The error that I am receiving is
Quote:




No value is given for one or more required parameters.




and stops at the rs.Open sSql, sConn, adOpenKeyset, adLockOptimistic, adCmdText line.
Here is my code:

Code:
Private Sub UpdateCounter()
Private Sub UpdateCounter()
Dim rs As New ADODB.Recordset
Dim sSql As String
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "css.mdb" & ";Persist Security Info=False"

sSql = "SELECT Counter " _
& " FROM tblLocation " _
& " WHERE Location = " & txtLabLocation.Text & ""

rs.Open sSql, sConn, adOpenKeyset, adLockOptimistic, adCmdText

rs!Counter = txtNextID.Text
rs.Update
rs.Close
Set rs = Nothing
End Sub
My goal is to update the counter with a new number without adding a another record to the lookup table. I hope this make sense.

Edit The Record In The Datagrid
how can i avoid an error such as"Insufficient key column information for updating and refreshing".this happened when i am trying to edit the record in the datagrid.what can i do to solve this error??for your info,i am trying to edit the record in the datagrid but still can't find the code.the error appear after i've edit the record in the datagrid..anybody can help me?tq..

Edit Same Record Twice, SQL Server, ADO
I used the vb (6) forms wizard to make a form using ado code.  This worked very nicely, and I was able to click up and down the recordset and make changes that were saved ok.
But ...
If I edit a record, go to another, go back to the original and make another change, I get an error message.  I can't remember the exact text, something to the effect that it could not find the original record.  There were references to the message on MS web, and reams of text, but no actual explanation of how to fix it.  I've got over the problem now by explaining to the customer that they really only wanted to edit one record on this form, so I've changed the whole thing.

Does anyone know how to fix this for future reference?


Peter Meachem
peter@accuflight.com

Edit A Field In A Record Set
I have got a record set and want to change the value of it.
However, I got an error when trying to change it.
What method should I use to open the record set in order to change its field?
or I must use a temp table to do so?

DAta Grid Using Adodc Control Doesn't Display Sorted Record Why?
Please Help me any coding suggestions...I have a datagrid using AdodcControl as a datasource cant display sorted record but instead the record is jumbled every time I load the form...I have tried using an SQL statement with Order BY [FIELD] ASC but still it wont work...Please can somebody help me about this problem...Thanks...

Copyright 2005-08 www.BigResource.com, All rights reserved