Verify that record Exists

  • Thread starter Thread starter GakDev
  • Start date Start date
G

GakDev

I need to see if a record exists when I load a form. If
it doesn't , I need to insert the information into a
table before the form is disolayed and the record
referenced should be the new record. I have to associate
a parent id to tie the record to the parent table. Any
help would be appreciated.
 
Sub Form_Load()

Form.RecordsetClone.FindFirst "KEYFIELD=WhatYouWantToFind"
If Form.RecordsetClone.NoMatch Then
' The record was not found. Create a new record
if not newrecord then docmd.runcommand
accmdrecordsgotonew
' Initialize the new record
[Field] = Value
else
' Go to the record you wanted
Bookmark = Form.RecordsetClone.Bookmark
end if

end sub
 
Back
Top