Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

MS Access Record Search and Form Population

Posted on 2007-08-02
5
Medium Priority
?
8,097 Views
Last Modified: 2013-11-29
I've created a form for users to Search/Edit records they create.  I want to allow them to search for records using the Record ID, Sales Engineer, or Customer Name. I have the first option (ID SEarch) working using the first script below.  
The second script is one that I'm attempting to use to search for records using a text field, allowing the user to search by "Sales Engineer".  I have the form data source set to a Query 1 that list the Record ID, Sales Engineer and Customer.  I can't seem to get this search to work like the ID Serch.  Please let me know what I'm missing.
Thanks,
- Joe

Private Sub Command5_Click()
On Error GoTo Err_Command5_Click
        Screen.PreviousControl.SetFocus
    DoCmd.OpenForm "TSE Input Form", , , "[ID]=" & Text3.Text
    Exit_Command3_Click:
    Exit Sub
Err_Command3_Click:
    MsgBox Err.Description
    Resume Exit_Command5_Click
    End Sub
_____________________________________________________________________________________
Private Sub FindRecord_Click()
On Error GoTo Err_FindRecord_Click
 Screen.PreviousControl.SetFocus
DoCmd.OpenForm "TSE Input Form", , , "[Sales Engineer]="" & text0.Text & """
Exit_FindRecord_Click:
    Exit Sub
Err_FindRecord_Click:
    MsgBox Err.Description
    Resume Exit_FindRecord_Click
  End Sub
0
Comment
Question by:westbrjb
  • 3
  • 2
5 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 19621097
try this


DoCmd.OpenForm "TSE Input Form", , , "[Sales Engineer]='" & text0 & "'"
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 19621147
you were using

dq -- double quote
                              dq dq                  dqdqdq
"[Sales Engineer]=" " & text0.Text & " " "


should be
sq --single quote
                             sqdq            dqsqdq
"[Sales Engineer]=' " & text0 & " ' "
0
 
LVL 13

Expert Comment

by:John Mc Hale
ID: 19622099
I like double-quotes in queries (it takes care of those data entry clerks that insist on entering names like O'Malley, O'Hara etc. Single quotes in this case would result in syntax errors!
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 19622167
if you type in a name  like O'hara then you should use
"[Sales Engineer]=" & chr(34) & text0 & chr(34)
0
 
LVL 13

Expert Comment

by:John Mc Hale
ID: 19622223
my point exactly!
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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
A quick solution showing how to control and open a POS Cash Register Drawer using VBA with MS Access.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

564 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