?
Solved

Alternative to DLOOKUP please

Posted on 2014-02-09
3
Medium Priority
?
797 Views
Last Modified: 2014-02-10
Running my access file as .ADP against SQL Server 2008

Have some old code using DLOOKUP

ReqPickupTime = DLookup("[ReqPickupTime]", "[qrySwiftJobs]", "[SwiftTitle] = '" & Me.[cmbSwiftSelect] & "'")
CalledInBy = DLookup("[CalledInBy]", "[qrySwiftJobs]", "[SwiftTitle] = '" & Me.[cmbSwiftSelect] & "'")
FromYourName = DLookup("[FromYourName]", "[qrySwiftJobs]", "[SwiftTitle] = '" & Me.[cmbSwiftSelect] & "'")
PhoneNo = DLookup("[PhoneNo]", "[qrySwiftJobs]", "[SwiftTitle] = '" & Me.[cmbSwiftSelect] & "'")
CompanyName = DLookup("[CompanyName]", "[qrySwiftJobs]", "[SwiftTitle] = '" & Me.[cmbSwiftSelect] & "'")

Open in new window


and this goes on for about 30 more controls...


SO qrySwiftJobs I thought would speed things up on the entire jobs table apx 300,000 records.

Need some ideas
0
Comment
Question by:Dale Massicotte
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Accepted Solution

by:
Gozreh earned 1920 total points
ID: 39846360
I'm not sure whats your question, Please explain more whats your problem with using the dlookup ?
But instead of the dlookup you can open a recordset and then fill in all fields.
   Dim rs As DAO.Recordset
   Set rs = CurrentDb.OpenRecordset("SELECT * FROM qrySwiftJobs WHERE [SwiftTitle] = '" & Me.[cmbSwiftSelect] & "'", dbOpenSnapshot, dbReadOnly)
   With rs
      ReqPickupTime = ![ReqPickupTime]
      CalledInBy = ![CalledInBy]
      FromYourName = ![FromYourName]
      PhoneNo = ![PhoneNo]
      CompanyName = ![CompanyName]
   End With
   Set rs = Nothing

Open in new window

0
 
LVL 48

Assisted Solution

by:Dale Fye
Dale Fye earned 80 total points
ID: 39846924
DLOOKUP will be very slow in this instance because it has to run the query and the Where clause for each of those controls.

Agree with Gozreh that you should be opening up a recordset, then just run down the list and apply those values to your controls.

I have not used an ADP, are you not able to create bound forms with the ADP?
0
 

Author Comment

by:Dale Massicotte
ID: 39847415
Thank you experts...this is what I needed.  I just have to modify the code for ADODB recordsets.
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question