Solved

How does this expression evaluate?

Posted on 1998-10-30
2
124 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
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

777 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