"John S. Ford, MD" wrote in message
...
Dear Dirk,
I'm using Access 2000 and here's the code for the form's OnOpen event:
Private Sub Form_Open(Cancel As Integer)
If Me.Recordset.RecordCount = 0 Then
Cancel = True
MsgBox "No admissions meet these criteria.", vbExclamation
Else
strSearchCriteria = Me.OpenArgs
txtOpenArgs = strSearchCriteria
txtDCStatusCriteria = DLookup("DischargeStatusType",
"qryLIST_DischargeStatusTypes", "DischargeStatusTypeIDNum=" &
GetVarValFromArg(strSearchCriteria, "DCStatus"))
txtTeamCriteria = DLookup("TeamName", "qryLISTALL_Teams",
"TeamIDNum=" & GetVarValFromArg(strSearchCriteria, "Team"))
txtResidentCriteria = DLookup("ResidentName",
"qryLISTALL_Residents", "ResidentIDNum=" &
GetVarValFromArg(strSearchCriteria, "Resident"))
txtInternCriteria = DLookup("InternName", "qryLISTALL_Interns",
"InternIDNum=" & GetVarValFromArg(strSearchCriteria, "Intern"))
End If
End Sub
All of the stuff in the Else clause was commented out for the purpose of
this experiment so errors wouldn't be triggered without the OpenArgs
argument.
Huh. I don't see anything there that explains what you're seeing. Do me a
favor -- comment out *all* the code in the Open event, and try it again.
By the way, I REALLY appreciate the work you're doing on this, but believe
me, I'm not trying to get you to do this for me! Don't feel you have to
continue!!
That's okay -- I'm interested. I just wish my ideas so far had panned out.
While a workaround has been suggested (setting the form's OrderBy property),
I'd like to get at the underlying cause.
I don't have a copy of Access 2000 installed to test with, unfortunately.
I'm using Access 2003, and can also test with Access 2007. Is your copy of
Access 2000 fully up-to-date with service packs? When it first came out, it
had a number of bugs.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)