Solved

Alternative to DLOOKUP please

Posted on 2014-02-09
3
665 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
3 Comments
 
LVL 10

Accepted Solution

by:
Gozreh earned 480 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 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 20 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now