You can alleviate those errors by using tpAttachWait and tpAttachNoWait parameters with your attach commands. The syntax looks like this:
Window("Application=IEXPLORE.EXE Caption='Select - Patient -- Webpage Dialog'", tpAttachNoWait).Attach
The length of time to wait is controlled by the parameter Playback.AttachTimeOut, which is a value in seconds.
AUT: Web app - Java/SQL
Using TestPartner since 2008
Using QTP since 2002