i've got a question is it pausible to put a date base like (access) in a project in vb.6.0 and how would i do it if pasueible.
don't mind the spelling Yoda
don't mind the spelling Yoda
'this is searching for existing data in your access
Private Sub Seek_Click() 'this is your button
Dim my_database As Database 'dimension database as database
Dim my_record As Recordset 'dimension recordset as recordset
Set my_database = OpenDatabase("C:\DataMining\Yoda.mdb")
'You can change above path/folder name to location of your own access
'database
'Going forward, above function will open the Yoda database
'Make your Yoda databse is closed
Set my_record = my_database.OpenRecordset("select * from Yodamania where UserID like '" & Text1.Text & "'") ' this is used to search by user id
Do While Not my_record.EOF
'this function will keep searching for fields matching each textbox
Text1.Text = my_record.Fields("UserID")
Text2.Text = my_record.Fields("Name")
Text3.Text = my_record.Fields("Address")
Text4.Text = my_record.Fields("Phone")
Text5.Text = my_record.Fields("Email")
my_record.MoveNext
Loop
my_database.Close
End Sub
Private Sub subt_Click() ' Here is your button
'this function will load entry into your Yoda database
Dim my_database As Database
'still dimension as database to VB knows what youa re attempting
Set my_database = OpenDatabase("C:\DataMining\Yoda.mdb")
'Keep below on the same line from my_database to '")", you are Excecuting this action to Yoda.mdb. Values from your Text1, 2, ect. Will entetred in UserID and so on...(Straight line Yoda, ok)
my_database.Execute "insert into Yoda.Yodamania(UserID, Name, Address, Phone,Email) Values('" & Text1.Text & "','" & Text2.Text & "' , '" & Text3.Text & "' , '" & Text4.Text & "','" & Text5.Text & "')"
my_database.Close '
'You will need to clear your textboxes here, do somehting like
'Text1.Text="" for all your textboxes
End Sub 'You should be all set
Comment