473,394 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

mapping of query result to access forms

I want to create a form which is linked to a table.I want to have an extra field "search" so that I can find the desired person...the search textfield will
have a corresponding button in it so that it can run a query which will show the result in the respective form fields related to the search.

Eg.

Form has 2 fields name ,id
in serch i want to enter the corresponding name to get the employee id...
I want the query to be specific like'abhishek' names may be many so it should show all the enteries related to the name 'abhishek'
Dec 7 '07 #1
1 1624
puppydogbuddy
1,923 Expert 1GB
I want to create a form which is linked to a table.I want to have an extra field "search" so that I can find the desired person...the search textfield will
have a corresponding button in it so that it can run a query which will show the result in the respective form fields related to the search.

Eg.

Form has 2 fields name ,id
in serch i want to enter the corresponding name to get the employee id...
I want the query to be specific like'abhishek' names may be many so it should show all the enteries related to the name 'abhishek'
Try the code below. Don't forget to replace object names used for illustrative purposes with the actual names of the objects in your application.

' Chr(42) is ASCii for the wildcard symbol *
' Assumes that Name and ID controls on the form are bound to the fields in the table
' assumes that the search textbox (txtSearch) on the form is unbound

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnSearch_Click()      'search button
  2. Dim strSql As String
  3.  
  4. strSql = "Select [Name], [ID] From YourTable Where [Name] Like '" & Chr(42) & Me!txtSearch & Chr(42) & "'"
  5.  
  6. Me.RecordSource = strSql
  7.  
  8. End Sub
Dec 8 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Jahmil Richardson | last post by:
Attempting to query MS Access database with the ODBC drivers for PHP. When using the LIKE statement no records are returned. Example: $query = " Select * From Dispatch Where Customer Like...
11
by: Surajit Laha | last post by:
I am firing a query like: SELECT TaskName, StartDate FROMTasks WHERE StartDate >= '01-Aug-2003' Now the result comes as: TaskName StartDate -------------------------- Task1 ...
3
by: Jack | last post by:
Hi, I have a form when loaded, retrieves record from an access table. Among other fields there is a check box called FinalUpdate. This is tied to a field in Access of type Yes/No. The form...
0
by: Rated R1 | last post by:
I have been able to acces my MS Access tables on my pocketpc using abcDb. HOWEVER I want to be able to run my database, the forms with the dropdown querys, etc and I cant find a program that I can...
3
by: milam | last post by:
Greetings, I would like to use a query result as a column name in another query, I can't seem to get this to work using Subqueries. Is there a good way to do this? Example: Table...
1
by: RookieDan | last post by:
Greetings fellow Accessers! Im new but in Access, but I have some background in different coding. I have a programme loading customer data into Access belonging to BMW dealers in Europe. ...
30
by: Noob | last post by:
ftp://ukcassassin:winston@www.ukcassassin.pwp.blueyonder.co.uk/htdocs/Diary%20Form.bmp Hi all I will appologise in advance for my lack of knowledge of access and its working as i am quite new to...
9
by: anthony | last post by:
In Access 2007, why does a query field designed as Term: ! ! return 00:00:00 when cboTerm actually contains 08SP. This works as expected in Access 2003?
0
by: tacofinger | last post by:
Hi, How to import MS Query result to Access Table? I have one MS query result from oracle ODBC and total record is 100ku records. I have tried to use link table from Access -import function but it...
0
by: Jason C | last post by:
I've got a simple database in Access 2007 with a form interface. One of the forms contains subforms and uses multiple tables, currently navigation works fine. There's also several complex queries...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.