Hi I am only an occasional programmer and very old school. I am being forced to convert code from VB6 to VS2012 due to work computer upgrades. I have read through lots of stuff on this topic within this forum and am still struggling to translate my vb code that interfaces with an Access database. Please can someone help me to translate? It is easier to understand I think if my own code is translated than someone elses!
This finds and edits a record within my database.
What would be the code in VS2012? Also, need to be able to delete a record and add a record.
Thanks
J
This finds and edits a record within my database.
Code:
If HTnumber.Text <> "" Then
'open database and define recordset
Set mydatabase = OpenDatabase("q:\janice\HT Hazard Database\HTHazardDatabase.mdb")
Set myrecordset = mydatabase.OpenRecordset("HT Form Table", dbOpenTable)
With myrecordset
.Index = "HTNumber"
htnum = "20" & Year.Text & HTnumber.Text
.Seek "=", htnum
End With
myrecordset.Edit
'save all changes to the front sheet pages
myrecordset.Fields("MaterialName").value = SampleName.Text
myrecordset.Fields("AltName").value = AltNames.Text
myrecordset.Fields("SampleRef").value = SampleRef.Text
myrecordset.update
myrecordset.close
mydatabase.close
Thanks
J