J
Jens Hofmeier
Hello,
i've got a mainform with a subform. The subforms contains a combobox
(cmb_PName)
that is used to search for a recor and if it is not found, to create a new
record and set it as the current record in the subform.
I use following code AfterUpdate of the combobox:
Set rst=CurrentDB.openrecordset("SELECT * FROM myTab")
With rst
.MoveFirst
.FindFirst ("Pname='" & cmb_Pname & "')"
If .NoMatch Then
'create new record
.AddNew
!FID_V = FID_V
!Pname = cmb_Pname
id = !ID_myTab
.Update
'Set new record as current record in subform
.FindFirst ("ID_myTab=" & id)
Forms!frm_Main!frm_Sub.SetFocus
Forms!frm_Main.frm_Sub.Bookmark = .Bookmark <<-- Error
Else
'record exists
Forms!frm_Main.frm_Sub.Bookmark = .Bookmark << --Error
End If
rst.close
End
I always get Runtime Error 438: Object does not support property/method
in the above marked lines.
Can anybode help?
Thanks in advance,
Jens
i've got a mainform with a subform. The subforms contains a combobox
(cmb_PName)
that is used to search for a recor and if it is not found, to create a new
record and set it as the current record in the subform.
I use following code AfterUpdate of the combobox:
Set rst=CurrentDB.openrecordset("SELECT * FROM myTab")
With rst
.MoveFirst
.FindFirst ("Pname='" & cmb_Pname & "')"
If .NoMatch Then
'create new record
.AddNew
!FID_V = FID_V
!Pname = cmb_Pname
id = !ID_myTab
.Update
'Set new record as current record in subform
.FindFirst ("ID_myTab=" & id)
Forms!frm_Main!frm_Sub.SetFocus
Forms!frm_Main.frm_Sub.Bookmark = .Bookmark <<-- Error
Else
'record exists
Forms!frm_Main.frm_Sub.Bookmark = .Bookmark << --Error
End If
rst.close
End
I always get Runtime Error 438: Object does not support property/method
in the above marked lines.
Can anybode help?
Thanks in advance,
Jens