473,466 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how do i update a field in a recordset ?

55 New Member
hi! i have a database with a idnumber, timein, timeout how do i search for the idnumber and then updating the timeout value of that particular recordset? im using access and my connections are not hardcoded what i usually do is just using the adodc for moving the file then click on the textbox that needs to be updated please help im not very good at this ..
Nov 13 '07 #1
6 2243
lotus18
866 Contributor
hi! i have a database with a idnumber, timein, timeout how do i search for the idnumber and then updating the timeout value of that particular recordset? im using access and my connections are not hardcoded what i usually do is just using the adodc for moving the file then click on the textbox that needs to be updated please help im not very good at this ..
Can you clarify this "click on the textbox that needs to be updated..."

Try using a SQL statement for searching the IDNumber or if you want, use a combobox to dropdown all the IDNumbers and select you want to update.

I came up with these simple code:

Expand|Select|Wrap|Line Numbers
  1. With Adodc1
  2.    .Refresh
  3.    .Recordset.Update
  4.    .Recordset.Fields(0) = Combo1.Text
  5.    .Recordset.Fields(1) = Text1.Text
  6.    .Recordset.Fields(2) = Text2.Text
  7.    .Recordset.Save
  8.    .Refresh
  9. End With
  10.  
Rey Sean
Nov 13 '07 #2
jaz215
55 New Member
Can you clarify this "click on the textbox that needs to be updated..."
what i meant was i just edit the textboxes then click on recordset.update and thats how i update it...

tnx for the code it help i didnt now i could use recordset.save sorry for being so noob :)

i'm not sure on what the proper syntax for searching the field ? its an idnumber
do while recordset.eof

if textidnumber = recordset.fields(0).value then
<code for update here>
else
recordset.movenext
end if
loop

IS this right?
any suggestion on improving this thanks
Nov 13 '07 #3
lotus18
866 Contributor
The IDNumber should be your primary key and you cannot update it.

Here's the code for searching the IDNumber

Expand|Select|Wrap|Line Numbers
  1. Dim strfind As String
  2. If txtIDNumber.Text = "" Then Exit Sub
  3. Adodc1.Recordset.MoveFirst
  4. strfind = "[IDNumber]='" & txtIDNumber.Text & "'"
  5. Adodc1.Recordset.Find strfind, 0, adSearchForward, Adodc1.Recordset.Bookmark
  6. If Adodc1.Recordset.EOF Then
  7.    MsgBox "No ID Number match your criteria", vbInformation, "Find Failure"
  8.    txtIDNumber.Text = ""
  9.    txtIDNumber.SetFocus
  10. End If
  11.  
Try to finish it. I know you can do it. :)
Nov 13 '07 #4
jaz215
55 New Member
The IDNumber should be your primary key and you cannot update it.
ooww i see i guess that was my problem because the idnumber is not my primary key. may table goes like this logid pk, idnum, timein, timeout
i guess what i should do is finding first the idnum and take the value of the logid my primary key then searching it again. so that i can update it? i'm not sure if my approach is right just giving a head's up on the primary key issue
Nov 14 '07 #5
jaz215
55 New Member
i've got the updating correctly now thanks to you.. :) my problem is now i can seem to see immediately the newly added data dont know why this is i tried refresh and requery but it doesnt work any help on this?
Nov 14 '07 #6
Killer42
8,435 Recognized Expert Expert
Sorry people, I've had to clean out quite a lot of this thread. TheScripts allows posting only in English.
Nov 15 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Sue Adams | last post by:
I actually have two issues/questions: I have an autonumber field in an access db table that I grab and later use to update a record in another table withing the same db. The code I use to get...
2
by: MVA | last post by:
Hi all I have a database where in a table (tbl_Members), there are 2 date fields (DateOfBirth and DateJoined), and also 2 fields which upon entering the data in the form, it automatically works...
2
by: Joseph Markovich | last post by:
I'm having some trouble with VB in Access 2000. I have a form that the user enters in just one number (in this case, it's a base salary) and then the program is going to do a bunch of math (which...
8
by: Maxi | last post by:
There is a lotto system which picks 21 numbers every day out of 80 numbers. I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21) Here is the structure and sample data: ...
6
by: Matt | last post by:
I'm having difficulty with trying to update a Access memo field through an SQL statement where the value I'm trying to pass is longer than 255 characters. The field is being truncated. I'm using...
9
by: zMisc | last post by:
When I try to update record, I kept getting this error: Row cannot be located for updating. Some values may have been changed since it was last read. No other users are accessing the database...
3
by: jpr | last post by:
Hello, I know that this is not the rule but need some help. My datbase has three tables: MASTER TEMPLATES FORMS I have a form which is based on a table named MASTER. I have a primary key...
1
by: Mark Reed | last post by:
Hi All, I'm having a problem with the following code. I've read quite a lot of old posts regarding the issue but none seem to affer a solution. The scenario is. I have a bound form which...
4
by: mmanojkumar | last post by:
Sir, I have a recordset "ADODC_path.recordset" which takes input from two tables When the field values are put into the textboxes and then edited and updated back into the tables, using the...
1
by: sphinney | last post by:
All, I have a ADODB.Recordset in my Access 2002 project. I've been able to successfully add fields to the record set. According the the MS Access help files, I now must update the recordset to...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.