[AccessD] Open a form and find a record

Nicholson, Karen cyx5 at cdc.gov
Mon Oct 18 13:31:59 CDT 2004


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?

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mcgillivray,
Donald [ITS]
Sent: Monday, October 18, 2004 2:23 PM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Open a form and find a record


Susan,

Try something like:

(air code)

	Dim stDocName As String
	Dim stLinkCriteria As String

	If Nz(Dlookup("[ProjectID]","tblProjects","[QAFName]='" &
Me![UsersName] & "'"),"NotFound") = "NotFound" Then
		MsgBox "You are not the QA on any projects."
	Else
		stDocName = "frmProjects"	
		stLinkCriteria = "[QAFName]=" & "'" & Me![UsersName] &
"'"
		DoCmd.Close 'Closes the menu form.
		DoCmd.OpenForm stDocName, , , stLinkCriteria
	End If

Just substitute your actual field and table names in the dlookup
function.

HTH,

Don McGillivray


-- 
_______________________________________________
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