Solved

DB Grid data control

Posted on 1998-07-19
3
168 Views
Last Modified: 2010-05-03
I am having a problem with this code:

Private Sub Command1_Click()


Let Data1.recordsource = "SELECT * FROM [STUDENT QUERY] WHERE MAJOR=me!TEXT1.text"

Data1.Refresh


End Sub

The Data1.refresh gives me an error that says " to few perimiters, expected 1"  if I put me!text1 in 'me!text1' it is not going to the text box.  How do I make it recognize the text box.  If I say "WHERE MAJOR='CIS'" IT WORKS FINE, BUT I DO NOT WANT TO HARD CODE THIS.

Any suggestions?

Thanks
0
Comment
Question by:DAVIDH
  • 2
3 Comments
 

Author Comment

by:DAVIDH
ID: 1466210
Edited text of question
0
 
LVL 1

Accepted Solution

by:
HenryChanE earned 50 total points
ID: 1466211
Try to convert to this,

Let Data1.recordsource = "SELECT * FROM [STUDENT QUERY] WHERE MAJOR= '" & trim(me!TEXT1.text) & "'"

    Data1.Refresh

This method always work. If not, check that you string really contains something !
0
 

Author Comment

by:DAVIDH
ID: 1466212
THANK YOU!!!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

705 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

16 Experts available now in Live!

Get 1:1 Help Now