?
Solved

SQL Problem and clearing FlexGrid

Posted on 1999-01-26
6
Medium Priority
?
173 Views
Last Modified: 2010-05-03
I have problem search an name that been enter and list out the name in that consist a particular string such as
 *bil*
How do we do this in SQL ? Following Are my source code

One more thing is how do i clear the FlexGrid if i like to empty it
 
Dim daorst As Recordset
Dim daodb As Database
Dim sSql As String
Dim x As Long
Set daodb = OpenDatabase("C:\Program Files\DevStudio\VB\TK2073\project2073.mdb")
sSql = "SELECT * FROM Makpel" & _
       " WHERE Makpel.nama = " & _
       Chr(34) & nama_s & Chr(34) & _
       " OR Makpel.nomatriks = " & _
       Chr(34) & nomatriks_s & Chr(34) & _
       " OR Makpel.alamatsemasa = " & _
       Chr(34) & alamat_s & Chr(34) & _
       " OR Makpel.namawaris = " & _
       Chr(34) & namawaris_s & Chr(34) & _
       " ORDER BY nama;"
Set daorst = daodb.OpenRecordset(sSql)
      With daorst
         Do While Not .EOF
         x = x + 1
         MSFlexGrid.AddItem .Fields("nama").Value & Chr(9) & _
         .Fields("nomatriks").Value & Chr(9) & _
         .Fields("namawaris").Value & Chr(9) & _
         .Fields("status").Value & Chr(9) & _
         .Fields("alamatsemasa").Value & Chr(9) & _
         .Fields("fakulti").Value & Chr(9) & _
         .Fields("jabatan").Value & Chr(9) & _
         .Fields("tahun").Value & Chr(9) & _
         .Fields("alamattetap").Value & Chr(9), x
         .MoveNext
0
Comment
Question by:winson
[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
  • 4
  • 2
6 Comments
 
LVL 10

Expert Comment

by:caraf_g
ID: 1470730
Half an answer:

To find names that have "bil" in them, use

WHERE YourNameField LIKE '%bil%'
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1470731
To clear your flex grid:

YourFlexGrid.Clear
0
 
LVL 10

Accepted Solution

by:
caraf_g earned 150 total points
ID: 1470732
Erm... I think that might answer your question
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:winson
ID: 1470733
the problem is that the nama_s in my sql is a variable
so if i  WHERE Makpel.nama Like '*nama_s*' it does NOT work
but if i WHERE Makpel.nama Like '*bil*' it's  working
and list all the word with *bil*
but the fact is nama_s = bil
pls HELP
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1470734
Use a string variable

Dim strSQLWhere As String

strSQLWhere = "WHERE Makpel.nama Like '*" & nama_s & "*'"

Good luck.

PS - just out of curiosity... what country are you from? I'm trying to guess but my best guess is Indonesia, please forgive me if I'm wrong!
0
 

Author Comment

by:winson
ID: 1470735
Close
Malaysia
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
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…
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

719 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