[AccessD] Open a form and find a record

Nicholson, Karen cyx5 at cdc.gov
Tue Oct 19 05:20:36 CDT 2004


Wowzer.  I am going to try this to see if this works faster than my
dlookup and relieves my conscience (sp?) of using dlookups when I know
this database will be upscaled someday and I won't have another
programmer complaining that I used dlookups.  Thanks.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart
McLachlan
Sent: Monday, October 18, 2004 6:26 PM
To: Access Developers discussion and problemsolving
Subject: RE: [AccessD] Open a form and find a record


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


-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list