Local Literature Transcript of Record System

Topics: Widgets, Real number, Ring Pages: 3 (383 words) Published: September 21, 2011
Hello, I have a combo box to select the ID, then it will display the particular record from from the database into the text boxes. And now I'm trying to make a update command button. Then I can just change the record which displaying in the text box. And click update, then the record will be updated in the database. But my cmdUpdate_Click() statement seems doesn't work. Anyone can help please? Cheers

Option Explicit
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset

Private Sub cmbID_Click()
If cmbID.Text = "[Make Selection]" Then Exit Sub
rs.Open "SELECT * FROM co_authors WHERE ID = " & cmbID.Text txtName.Text = rs!author_Name
txtCountry.Text = rs!country
txtPaperID.Text = rs!paper_ID
End Sub

Private Sub cmdGo_Add_submission_info_Click()
End Sub

Private Sub cmdUpdate_Click()
Dim ar As ADODB.Recordset
Set ar = New ADODB.Recordset
ar.Open "SELECT * FROM co_authors WHERE ID = " & cmbID.Text If ar.EOF Then ar.AddNew
Else: ar.Update
End If
ar!author_Name = txtName.Text
ar!country = txtCountry.Text
ar!paper_ID = txtPaperID.Text
End Sub

Private Sub Form_Load()

Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset

conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=H:\262CS\project\db1.mdb;" & _ "Persist Security Info=False"

rs.Open "SELECT ID FROM co_authors", _
conn, adOpenForwardOnly, adLockReadOnly, adCmdText

cmbID.Text = "[Make Selection]"

Do Until rs.EOF
cmbID.AddItem rs!ID


End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If rs.State = adStateOpen Then rs.Close
If conn.State = adStateOpen Then conn.Close
Set rs = Nothing
Set conn = Nothing
End Sub


If this problem is still not solve you can try this:::

This is your code:

Private Sub cmdUpdate_Click()
Dim ar As ADODB.Recordset
Set ar =...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Essay on Local Literature
  • local literature Research Paper
  • Essay on Local Literature
  • LOcal literature Essay
  • Local Literature Essay
  • Essay about Local Literature
  • Local Literature Essay
  • Record System Essay

Become a StudyMode Member

Sign Up - It's Free