After close 2. modal form, access is locked

T

TNL

Hi,
I have a unbound form, that is opened as modal.
On this form there is a commandbutton, this open 2. modal form. The code is following

Private Sub cmdCustomerSearch_Click()

Dim lID As Long

If SearchId(lID) = True Then
CustomerId.Value = lID
CustomerId.SetFocus
End If
end sub

private function SearchID(lID as long) as boolean
sFormname = "frmSearch"
If IsFormLoaded(1, sFormname, False) Then
DoCmd.Close acForm, sFormname
End If

DoCmd.OpenForm sFormname, , , , , acDialog, sOpenargs
If IsFormLoaded(sFormname) Then
lID = Forms(sFormname).Id
DoCmd.Close acForm, sFormname
End If
.....
end sub


But after closing the 2. form (frmSearch), the system (access) is locked, I can't do anything more, it beep only. From VBA code windows, I can still close the 1. form with command docmd.close...

It is surprised, when I run the code in debug (break) modus at the line "If SearchId(lID) = True Then", then I can still work with the 1. form, but when I close this form, the system is locked again)

Why? Can anybody help me?

Thanks
TNL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top