|
-
August 20th, 2001, 10:02 PM
#1
source code
Below is the source code for search, add, edit, delete using Microsoft access as my database:
The object that I have are: Microsoft ADO Data Control 6.0(OLEDB),Microsoft DataGrid Control 6.0(OLEDB),(3)command buttons, (3)textbox. Since I'm using VB6 and ACCESS 2000 in VB6 I already check in the reference the "Microsoft DAO 3.6 Object Library" for me to access the database which I was created in MSACCESS. I also connect the ADODataControl for me to display the record in run-time in short the program was running properly.
Option explicit
Dim conmastr As Database
Dim table1 As Recordset
Private Sub Form_Load()
Set conmastr = DBEngine.OpenDatabase(App.Path & "/conmastr.mdb")
Set table1 = conmastr.OpenRecordset("table1")
End Sub
Private Sub cmd_search_Click() (command button)
Table1.Index = "lastname"
Table1.Seek "=", Text1.Text
If table1.NoMatch Then
MsgBox "record not found", vbInformation
Else
Text1.Text = table1!lastname
Text2.Text = table1!firstname
Text3.Text = table1!midname
End If
End Sub
Private Sub cmd_save_Click() (command button)
Table1.addnew
********
********
********
********
Table1.update
End sub
Private Sub cmd_delete_Click() (command button)
Table1.delete
********
********
********
********
Table1.update
End sub
Private Sub cmd_edit_Click() (command button)
Table1.edit
********
********
********
********
Table1.update
End sub
Now what if my database was created in foxpro for windows ver.2.6 what will I do. Hope you can give me some instruction on how to do it or some source code inorder for me to run the program just like the one that I introduce a while ago.
Immediate response will highly appreciated!!!!
Thank You in advance!!!!!!!!!
More Power!!!!!!
-
August 21st, 2001, 01:35 AM
#2
Re: source code
Just A Suggestion:
Create a data source name(DSN) for ur FoxPro Database in ODBC for Windows.
Refer the Connection in ADO using this DSN
Good Luck
If u don't know how to Rate an answer, then Rate my answer to learn, If u know, then practice it 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|