Stuart McLachlan
stuart at lexacorp.com.pg
Mon Oct 18 17:26:08 CDT 2004
On 18 Oct 2004 at 14:31, Nicholson, Karen wrote:
> OK. I am doing the same thing to open a form and determine pretty much
> the same kind of filter. I get queezy using dlookups and was trying to
> find a better way, not using dlookups, to achieve the same
> functionality. I was under the assumption that using dlookups is a nono
> as other programs do not understand them (in the event I upgrade to
> VB.net) and dlookups are slow. Any other suggestions beside the old
> dlookup method?
>
If you want to avoid DLookup/DCount et al, you can roll your own
equivalent. Something along the lines of:
Function IsQA(User as String) as Boolean
Dim rs as DAO.Recordset
rs = CurrentDB.Openrecordset("Select count(*) from tblProjects where
QAFName = '" & User & "'")
IsQA = rs(0)
End Function
Then just use:
If IsQA(Username) Then
DoCmd.OpenForm "frmProjects",,,,"QAFName ='" & Username & "'"
Else
MsgBox "You are not QA on any Project"
End If
--
Stuart