> 1. How to retrieve the new counter so I don't save on top of an existing
> record when I press the update/add button?
You can use a automatic counterfield. Or if you don't want to do this,
get the highest counter from the table before saving the record. You
can use a simple query to get it:
sql = "SELECT counter FROM table ORDER BY counter DESC"
set rs = db.OpenRecoprdSet(sql)
HighestCounter = rs.Fields(0).Value
Because the output is sorted descending the highest value is alway
the first record.
> 2. How to reset comboboxes and option buttons so nothing is selected
> when the Add button is pressed?
use the Forms.Collection to set the property enabled = False:
Public Sub AllowEntry(yesno As Boolean)
Dim Crt as Control
For Each Crt in Form1.Controls
If TypeOf Crt is OptionButton Or _
TypeOf Crt Is ComboBox The
If yesno Then
Crt.Enabled = True
Else
Crt.Enabled = False
End If
End If
Next Crt
End Sub
> 3. How to undo Add or Delete (or something which allows the user to cancel
> the action)?
Delete is simple:
step 1: search for the record (you have the counternumber as an index)
set rs = db.OpenRecordSet(table)
set rs.Index = "counter"
rs.Seek "=", [counter to search]
If Not rs.NoMatch Then rs.Delete
Undo is more work... a search and delete is much simplier and
also fast.
Return