Solved

microsoft access question

Posted on 2016-10-07
8
61 Views
Last Modified: 2016-10-07
how do i  create a button on form to search by macro?
0
Comment
Question by:Tony T
[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
  • 4
8 Comments
 
LVL 19

Expert Comment

by:Eric Sherman
ID: 41833806
Use the OnClick Event of your button to run your Macro as shown below.
Capture1
ET
0
 

Author Comment

by:Tony T
ID: 41833842
thank you.
I need a macro script for searching
Snap1293.jpg
0
 

Author Comment

by:Tony T
ID: 41833985
I'm getting following error
Private Sub Command5_Click()
Dim strsearch As String
Dim Task As String
'Check if a keyword entered or not
If IsNull(Me.txtSearch) Or Me.txtSearch = "" Then
   MsgBox "Please type in your search keyword.", vbOKOnly, "Keyword Needed"
   Me.txtSearch.BackColor = vbYellow
   Me.txtSearch.SetFocus
Else
    strsearch = Me.txtSearch.Value
    Task = "SELECT * FROM Copy and Paste WHERE ((Comment Like ""*" & strsearch & "*""))"
   Me.Comment = Task
   Me.txtSearch.BackColor = vbWhite
End If
End Sub

Open in new window

Snap1295.jpg
Snap1296.jpg
0
Myth Busting: MongoDB Scalability (it scales!)

I was talking with one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. He mentioned to me that several customers have been telling him that “MongoDB doesn’t scale!” MongoDB’s scalability was in question?

My response was, “Is that a joke?"

 
LVL 19

Accepted Solution

by:
Eric Sherman earned 500 total points
ID: 41834025
I think your SQL is not correct ... The Select statement you look like this:

Task = "SELECT * FROM YourTableNameHere WHERE ((YourFieldNameHere Like ""*" & strsearch & "*""))"
Me.RecordSource = Task

ET
0
 

Author Comment

by:Tony T
ID: 41834074
thank you.
what should i put here?
Snap1297.jpg
0
 

Author Closing Comment

by:Tony T
ID: 41834100
thank you
0
 
LVL 19

Expert Comment

by:Eric Sherman
ID: 41834143
Post the contents of your string variable Task after it has been populated.

ET
0
 
LVL 19

Expert Comment

by:Eric Sherman
ID: 41834190
Try this for your SELECT statement ...

Task = "SELECT * FROM TableName WHERE FieldName LIKE '*" & strSearch & "*';"


ET
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

631 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