Well, the example is a nice way to do it, but not the better.
The example state that you open a recordset when you load the form and add a record in that moment. For example if you cancel, the program just end, keeping open the connection and never canceling the add new or closing the recordset. If you have several connections to that table, that will be a very bad way to do it. You only want to add the record when you have the data. Otherwise the user could be in that screen hours and will forbids others connection (since the add new is active). Also, is always better to have a column with a numeric code to make searches easier.
Anyway, to make it work do something like this:
Code:
'in the top of the form
dim bFirstTime as boolean = true
'in the load event
Private Sub Form_Load()
'nothing
End Sub
Private Sub Form_show()
If bFirstTime then
'your code
...
bFirstTime = false
End If
End Sub
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========