473,320 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

help in editing information in database

i need help . im using ADODC for my database settings, VB6. can anyone tell me how to edit the database ? need help asap.. thnx allot
May 2 '07 #1
5 1762
Killer42
8,435 Expert 8TB
i need help . im using ADODC for my database settings, VB6. can anyone tell me how to edit the database ? need help asap.. thnx allot
I think you need to describe in more detail what you want to do.
May 2 '07 #2
i have an edit box beside each attribute, for example, i have and edit btn box, beside my name text box (thats for now).. when i click the edit btn box, it will edit the Name information in my database for the selected information in the database...

Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2.  
  3.  
  4. Private Sub cmdAddEntry_Click()
  5.     With Adodc1.Recordset
  6.         .AddNew
  7.         !Name = txtName
  8.         !IC = txtIC
  9.         !Unit = txtUnit
  10.         !Gender = txtGender
  11.         !Address = txtAddress
  12.         !Contact = txtContact
  13.         !Payment = txtPayment
  14.         .Update
  15.         .Requery
  16.     End With
  17.  
  18.  
  19.     Adodc1.Refresh
  20.     Set MSHFlexGrid1.DataSource = Adodc1
  21.     MSHFlexGrid1.FormatString = "    |  Name               | IC              | Unit          |  Gender             | Address              | Contact         | Payment         "
  22.     txtName = ""
  23.     txtIC = ""
  24.     txtUnit = ""
  25.     txtGender = ""
  26.     txtAddress = ""
  27.     txtContact = ""
  28.     txtPayment = ""
  29.     txtName.SetFocus
  30. End Sub
  31.  
  32.  
  33.  
  34. Private Sub cmdEditName_Click()
  35.     With Adodc1.Recordset
  36.     .Update
  37.      i dunno what should i do here...
  38.  
  39.  
  40.  
  41.     Adodc1.Refresh
  42.     Set MSHFlexGrid1.DataSource = Adodc1
  43.     MSHFlexGrid1.FormatString = "    |  Name               | IC              | Unit          |  Gender             | Address              | Contact         | Payment         "
  44.     txtName.SetFocus
  45. End Sub
  46.  
  47. Private Sub cmdRemoveEntry_Click()
  48.  
  49.     With Adodc1.Recordset
  50.         .Move (MSHFlexGrid1.Row - 1)
  51.         .Delete
  52.         .Requery
  53.     End With
  54.     Adodc1.Refresh
  55.     Set MSHFlexGrid1.DataSource = Adodc1
  56.     MSHFlexGrid1.FormatString = "    |  Name               | IC              | Unit          |  Gender             | Address              | Contact         | Payment         "
  57.     txtName.SetFocus
  58. End Sub
  59. Private Sub Form_Load()
  60.     With Adodc1
  61.         .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
  62.             App.Path & "\database3.mdb;Persist Security Info=False"
  63.         .RecordSource = "select * from Tenant order by Name"
  64.     End With
  65.     Set MSHFlexGrid1.DataSource = Adodc1
  66.     MSHFlexGrid1.FormatString = "    |  Name               | IC              | Unit          |  Gender             | Address              | Contact         | Payment         "
  67. End Sub
  68.  
  69.  
  70. Private Sub txtName_Change()
  71.  
  72.  
  73.     If txtName.Text <> "" And txtIC.Text <> "" And txtUnit.Text <> "" And txtGender.Text <> "" And txtAddress.Text <> "" And txtContact.Text <> "" And txtPayment.Text <> "" Then
  74.         cmdAddEntry.Enabled = True
  75.     Else
  76.         cmdAddEntry.Enabled = False
  77.     End If
  78.  
  79. End Sub
  80.  
  81. Private Sub txtIC_Change()
  82.     Call txtName_Change
  83. End Sub
  84.  
  85. Private Sub txtUnit_Change()
  86.     Call txtName_Change
  87. End Sub
  88. Private Sub txtGender_Change()
  89.     Call txtName_Change
  90. End Sub
  91. Private Sub txtAddress_Change()
  92.     Call txtName_Change
  93. End Sub
  94. Private Sub txtContact_Change()
  95.     Call txtName_Change
  96. End Sub
  97. Private Sub txtPayment_Change()
  98.     Call txtName_Change
  99. End Sub
  100.  
  101. Private Sub txtTrackCount_KeyPress(KeyAscii As Integer)
  102.  
  103.  
  104.     Dim TrackKey As String
  105.     TrackKey = Chr(KeyAscii)
  106.  
  107.     If (Not IsNumeric(TrackKey) And Not (KeyAscii = vbKeyBack)) Then
  108.         KeyAscii = 0
  109.     End If
  110.  
  111. End Sub
  112. [XOption Explicit
  113.  
  114.  
  115. Private Sub cmdAddEntry_Click()
  116.     With Adodc1.Recordset
  117.         .AddNew
  118.         !Name = txtName
  119.         !IC = txtIC
  120.         !Unit = txtUnit
  121.         !Gender = txtGender
  122.         !Address = txtAddress
  123.         !Contact = txtContact
  124.         !Payment = txtPayment
  125.         .Update
  126.         .Requery
  127.     End With
  128.  
  129.  
  130.     Adodc1.Refresh
  131.     Set MSHFlexGrid1.DataSource = Adodc1
  132.     MSHFlexGrid1.FormatString = "    |  Name               | IC              | Unit          |  Gender             | Address              | Contact         | Payment         "
  133.     txtName = ""
  134.     txtIC = ""
  135.     txtUnit = ""
  136.     txtGender = ""
  137.     txtAddress = ""
  138.     txtContact = ""
  139.     txtPayment = ""
  140.     txtName.SetFocus
  141. End Sub
  142.  
  143.  
  144.  
  145. Private Sub cmdEditName_Click()
  146.     With Adodc1.Recordset
  147.     .Update
  148.  
  149.  
  150.  
  151.  
  152.     Adodc1.Refresh
  153.     Set MSHFlexGrid1.DataSource = Adodc1
  154.     MSHFlexGrid1.FormatString = "    |  Name               | IC              | Unit          |  Gender             | Address              | Contact         | Payment         "
  155.     txtName.SetFocus
  156. End Sub
  157.  
  158. Private Sub cmdRemoveEntry_Click()
  159.  
  160.     With Adodc1.Recordset
  161.         .Move (MSHFlexGrid1.Row - 1)
  162.         .Delete
  163.         .Requery
  164.     End With
  165.     Adodc1.Refresh
  166.     Set MSHFlexGrid1.DataSource = Adodc1
  167.     MSHFlexGrid1.FormatString = "    |  Name               | IC              | Unit          |  Gender             | Address              | Contact         | Payment         "
  168.     txtName.SetFocus
  169. End Sub
  170. Private Sub Form_Load()
  171.     With Adodc1
  172.         .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
  173.             App.Path & "\database3.mdb;Persist Security Info=False"
  174.         .RecordSource = "select * from Tenant order by Name"
  175.     End With
  176.     Set MSHFlexGrid1.DataSource = Adodc1
  177.     MSHFlexGrid1.FormatString = "    |  Name               | IC              | Unit          |  Gender             | Address              | Contact         | Payment         "
  178. End Sub
  179.  
  180.  
  181. Private Sub txtName_Change()
  182.  
  183.  
  184.     If txtName.Text <> "" And txtIC.Text <> "" And txtUnit.Text <> "" And txtGender.Text <> "" And txtAddress.Text <> "" And txtContact.Text <> "" And txtPayment.Text <> "" Then
  185.         cmdAddEntry.Enabled = True
  186.     Else
  187.         cmdAddEntry.Enabled = False
  188.     End If
  189.  
  190. End Sub
  191.  
  192. Private Sub txtIC_Change()
  193.     Call txtName_Change
  194. End Sub
  195.  
  196. Private Sub txtUnit_Change()
  197.     Call txtName_Change
  198. End Sub
  199. Private Sub txtGender_Change()
  200.     Call txtName_Change
  201. End Sub
  202. Private Sub txtAddress_Change()
  203.     Call txtName_Change
  204. End Sub
  205. Private Sub txtContact_Change()
  206.     Call txtName_Change
  207. End Sub
  208. Private Sub txtPayment_Change()
  209.     Call txtName_Change
  210. End Sub
  211.  
  212. Private Sub txtTrackCount_KeyPress(KeyAscii As Integer)
  213.  
  214.  
  215.     Dim TrackKey As String
  216.     TrackKey = Chr(KeyAscii)
  217.  
  218.     If (Not IsNumeric(TrackKey) And Not (KeyAscii = vbKeyBack)) Then
  219.         KeyAscii = 0
  220.     End If
  221.  
  222. End Sub
May 2 '07 #3
anyone can help?
May 2 '07 #4
Er0ck
1
hey buddy i was just lookin around for some for some other vb tips and came across your post...
i think what you want is
with "whatever"
.edit 'here is what you were missing
!bla bla
!bla bla = bla
!and so on
.update
end with
May 19 '07 #5
Killer42
8,435 Expert 8TB
Thanks for that Er0ck. Sorry dreamonzzz, I completely forgot to get back to this one.

I'm afraid I never did entirely understand the question. Is this what you were looking for?
May 21 '07 #6

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

Similar topics

2
by: Tiernan | last post by:
Hey everybody. I'm verry new to PHP and MYSQL and have been working on a form that when it is submitted stores the information into a mysql database. The main problem is that i'm trying to finish...
1
by: nospam | last post by:
Amazon wins patent for ordering forms, Collapsing and Maximizing Form Areas.... NAME OF PATENT Method and system for displaying and editing of information # 6,615,226 ...
28
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical...
5
by: Steve Patrick | last post by:
Hi All You guys are my last hope, despite spending money on books and hours reading them I still can not achieve the results I need. I have designed a database in Access 2000 based on 1 table,...
4
by: Daedric | last post by:
Hello and thanks in advance to anyone who offers help. To make this simple, let's say I have a game which has 100 different monsters. I want a binary data file to hold all of these. It would...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
7
by: Niyazi | last post by:
Hi, I am developing small insurance application using VB.NET and SQL server 2000. My tables in SQL server are: tbl_Customer (stores the custmer information) tbl_CustImage ...
4
by: Brad Isaacs | last post by:
I am working with ASP.NET 2.0 and using an SQL Server 2000 database. I am using Visual Studio 2005 and developing on my Local machine. I am working with Login controls ASP.Configuration, I...
15
by: colemanj4 | last post by:
Here is what I have so far, it loops while the PW is incorrect, or until cancel is selected. I want it to lock the tables for adds, deletes, and edits when cancel is selected, and if the PW is...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.