finding record in MS Access

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jul 2008
Posts: 3
Reputation: yanie is an unknown quantity at this point 
Solved Threads: 0
yanie yanie is offline Offline
Newbie Poster

finding record in MS Access

 
0
  #1
Jul 29th, 2008
ui.bmp

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..
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,149
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 132
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: finding record in MS Access

 
0
  #2
Jul 29th, 2008
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%'
Share your Knowledge.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 505
Reputation: abu taher is an unknown quantity at this point 
Solved Threads: 25
abu taher's Avatar
abu taher abu taher is offline Offline
Posting Pro

Re: finding record in MS Access

 
0
  #3
Jul 29th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 3
Reputation: yanie is an unknown quantity at this point 
Solved Threads: 0
yanie yanie is offline Offline
Newbie Poster

Re: finding record in MS Access

 
0
  #4
Jul 29th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,149
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 132
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: finding record in MS Access

 
0
  #5
Jul 30th, 2008
please correct this

b = "Employee Number Like """ & a & "*"""
Share your Knowledge.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 3
Reputation: vprakash is an unknown quantity at this point 
Solved Threads: 1
vprakash's Avatar
vprakash vprakash is offline Offline
Newbie Poster

Re: finding record in MS Access

 
0
  #6
Jul 31st, 2008
b = "Employee Number Like ' " & a & " ' "

this will help u i think

with regards
prakash
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 1813 | Replies: 5
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC