943,758 Members | Top Members by Rank

Ad:
Jul 29th, 2008
0

finding record in MS Access

Expand Post »
Name:  ui.bmp
Views: 468
Size:  989.0 KB


i hv an interface sumthing like this. i/m using VB6 and i wanna find record in MS Access using find command button. firstly user will key in an employee number as a key to find that user record in MS Access. after that, the data will appear in the form above the search frame. im new with VB6'so i need some help.. thanks..
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
yanie is offline Offline
3 posts
since Jul 2008
Jul 29th, 2008
0

Re: finding record in MS Access

You can do this ata database level using SQL queries.

if the employee number is a number use emp_number=number
if the employee number is a string use emp_number like '%string%'
Featured Poster
Reputation Points: 665
Solved Threads: 427
Posting Genius
debasisdas is offline Offline
6,406 posts
since Feb 2007
Jul 29th, 2008
0

Re: finding record in MS Access

Private Sub cmdfind_Click()
Dim a As String
Dim b As String


a = text1.text 'employee number
If Len(a) = 0 Then Exit Sub
b = "Employee Number Like """ & a & "*"""
Data1.Recordset.FindNext b
If Data1.Recordset.NoMatch Then
MsgBox "No record found", vbExclamation
end If
Exit Sub
Last edited by Tekmaven; Jul 30th, 2008 at 9:48 am. Reason: Code tags
Reputation Points: 14
Solved Threads: 78
Practically a Posting Shark
abu taher is offline Offline
835 posts
since Jul 2008
Jul 29th, 2008
0

Re: finding record in MS Access

when i put dis coding, there was an error.
Run-time error '3077'
Syntax error (missing operator) in expression.

when i debug, the error was at:
Data1.Recordset.FindNext b
Reputation Points: 10
Solved Threads: 0
Newbie Poster
yanie is offline Offline
3 posts
since Jul 2008
Jul 30th, 2008
0

Re: finding record in MS Access

please correct this

b = "Employee Number Like """ & a & "*"""
Featured Poster
Reputation Points: 665
Solved Threads: 427
Posting Genius
debasisdas is offline Offline
6,406 posts
since Feb 2007
Jul 31st, 2008
0

Re: finding record in MS Access

b = "Employee Number Like ' " & a & " ' "

this will help u i think

Reputation Points: 10
Solved Threads: 1
Newbie Poster
vprakash is offline Offline
3 posts
since Jul 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: visual basic programming
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Access Parent node from a child node





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC