Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How does this expression evaluate?

Posted on 1998-10-30
2
Medium Priority
?
135 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 800 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

Technology Partners: 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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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 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…
Suggested Courses

772 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