Solved

How does this expression evaluate?

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb6 connector to mongodb 2 163
Getting warning: You are about to delete 1 row(s) 9 61
Set email body to html using vbscript 6 96
Send outlook email from VBS Script 2 67
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

751 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