Solved

How does this expression evaluate?

Posted on 1998-10-30
2
130 Views
Last Modified: 2010-04-30
Look at the following code please:

Form1.Data1.Recordset.FindFirst Form1.Text1.DataField & " = '" & "First Value" & "'"

The above statement works well, but I would prefer to use a variable for .Data1. and also .Text1.   but I don't know how   to get variables into that command string and have it evaluate without and error.

Thanks in advance.
0
Comment
Question by:tisd
[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
2 Comments
 
LVL 3

Accepted Solution

by:
traygreen earned 200 total points
ID: 1442640
Pass the controls in to a proc and go from there.
You would determine which controls to send based on you or the user's selection.

Public Sub FindFirstInstance (pDataControl as control, pFindControl as control)

   If TypeOf pDataControl Is Data Then
      If TypeOf pFindControl Is TextBox Or _
         TypeOf pFindControl Is ComboBox Then
         
         pDataControl.RecordSet.FindFirst pFindControl.DataField & "='" & "First Value" & "'"
   
      End If
   End If
   
end sub
0
 

Author Comment

by:tisd
ID: 1442641
This technique worked well. Thanks
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

631 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