?
Solved

Searching for record

Posted on 2002-06-19
4
Medium Priority
?
153 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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
Course of the Month9 days, 13 hours left to enroll

762 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