[b][red]This message was edited by Lensmeister at 2005-7-25 9:29:16[/red][/b][hr]
Hi everyone ... can someone please hep me .... when I clickl the toolbar to add a record the focus is on the correct bos I enter the details and then click the save button on the toolbar. BUT nothing saves ......
[code]
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
Case 1
On Error Resume Next
adoJournal.Recordset.AddNew
'txtDayNum.SetFocus
Case 2
If Not adoJournal.Recordset.BOF Then
adoJournal.Recordset.MoveFirst
If adoJournal.Recordset.BOF Then
MsgBox "You are at the First Entry already"
End If
End If
lblDatabaseInfo.Caption = "Journal Number " & (adoJournal.Recordset.AbsolutePosition) & " of " & adoJournal.Recordset.RecordCount & " !"
Case 3
' Move BACK one Record in the database.
If Not adoJournal.Recordset.BOF Then
adoJournal.Recordset.MovePrevious
If adoJournal.Recordset.BOF Then
MsgBox "You are at the begining of the Journal Databse"
adoJournal.Recordset.MoveNext
End If
End If
lblDatabaseInfo.Caption = "Journal Number " & (adoJournal.Recordset.AbsolutePosition) & " of " & adoJournal.Recordset.RecordCount & " !"
Case 4
' Move forward one Record in the database.
If Not adoJournal.Recordset.EOF Then
adoJournal.Recordset.MoveNext
If adoJournal.Recordset.EOF Then
MsgBox "You are at the end of the Journal Databse"
adoJournal.Recordset.MovePrevious
End If
End If
lblDatabaseInfo.Caption = "Journal Number " & (adoJournal.Recordset.AbsolutePosition) & " of " & adoJournal.Recordset.RecordCount & " !"
Case 5
If Not adoJournal.Recordset.EOF Then
adoJournal.Recordset.MoveLast
If adoJournal.Recordset.EOF Then
MsgBox "You are at the Last Entry already"
End If
End If
lblDatabaseInfo.Caption = "Journal Number " & (adoJournal.Recordset.AbsolutePosition) & " of " & adoJournal.Recordset.RecordCount & " !"
Case 6
' Save the entries
On Error Resume Next
adoJournal.Recordset.Update ("number, day, year, title, daysummary, summary, dateoutward, datereturn, country, destination")
adoJournal.Refresh
MsgBox ("Update to journal databse is completed successfully")
Case 7
'database refresh
adoJournal.Refresh
End Select
End Sub
[/code]
the onload is thus:
[code]
Private Sub Form_Load()
On Error GoTo 100
'Connecting to the DB for Access 2000 or higher DB name
adoJournal.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & " ravelogue.mdb" & ";Jet OLEDB:Database Password="
' SQL Statement to Select * (all Fields) from the Table Named journal)
adoJournal.RecordSource = "Select * FROM journal ORDER BY journal.Number, journal.day"
adoJournal.Refresh
lblDatabaseInfo.Caption = "Journal Number " & (adoJournal.Recordset.AbsolutePosition) & " of " & adoJournal.Recordset.RecordCount & " !"
Exit Sub
100
MsgBox Err.Description
End Sub
[/code]
Thanks for any help,
Comments
[code]
Case 2
If Not adoJournal.Recordset.BOF Then
adoJournal.Recordset.MoveFirst
If adoJournal.Recordset.BOF Then
MsgBox "You are at the First Entry already"
End If
End If
[/code]
I think this condition, when the MsgBox is displayed means "There are no records"
I don't realy know how you set values to text boxes, but I think you should use Fields collection. Then when you use Update (without arguments) it should update the values without any problem.