Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Searching for record

Posted on 2002-06-19
4
Medium Priority
?
155 Views
Last Modified: 2010-05-02
I have about 10 to 15 textbox controls that are bind to a datasource called data1
(Data1 is a data control). The textbox controls have their own datafields.
There is also a combo box which is fill with PolicyNo(one of the fields from the database)
When i choose one of the PolicyNo from the combo box, it should move to the record
that i want and update the other textboxes.
I tried using the Data1.Recordset.Move n, start
But how do i know the index of the record that i am currently in?????
0
Comment
Question by:laukhengsiong
[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
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
Mahdi Mansour earned 60 total points
ID: 7092339
you can know the record u r in by doing a select ......
try:

data1.recourdsource="select * from TableName where PolicyNo = " & combo.text & " ; " 
data1.refresh

...
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 7092384
You should use the FindFirst method:

Data1.Recordset.MoveFirst
Data1.Recordset.FindFirst "PolicyNo = '" & Combo1.Text & "'"
If Data1.Recordset.NoMatch Then
  Msgbox "Couldn't Find " & Combo1.Text
End If

Where PolicyNo is the field name in the recordset to look in and the policy number to match is a string value. If it is a numeric field then remove the ' characters as they are no longer required.
0
 

Author Comment

by:laukhengsiong
ID: 7094610
the comment by kasanova works. BUT after using the refresh method, the combo box which bind to the field PolicyNo in the dbase becomes ""(EMPTY). i did not use the SELECT * to select all fields cos the function will not work so I select individual fields that i want and IT works!. Any idea why the combo box becomes empty???? Thanx
0
 

Author Comment

by:laukhengsiong
ID: 7094613
i know why already.. i should not bind the PolicyNo textbox to the dbase.. Just find out..Sorry
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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

610 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