|
-
Jan 28th, 2003, 08:28 PM
#1
Thread Starter
Lively Member
VB and Access Database.
OK I am totally new to Access, I've created 2 fields in Access
will say name Username and ID.
then I saved it.
nvc.db
So that is my access file, so now I want to call the access file I have that.
now does anyone have documentation on how to create a proper Access file.. something simple .. I can create the link with VB to the file..
thank you all
-
Jan 28th, 2003, 08:55 PM
#2
Member
goto msdn.microsoft.com and do a search on DAO or ADO, ADO preferably. all the simple documentation you need ; )
-
Jan 28th, 2003, 10:05 PM
#3
PowerPoster
Re: VB and Access Database.
Originally posted by nvc944
OK I am totally new to Access, I've created 2 fields in Access
will say name Username and ID.
then I saved it.
nvc.db
So that is my access file, so now I want to call the access file I have that.
now does anyone have documentation on how to create a proper Access file.. something simple .. I can create the link with VB to the file..
thank you all
Open a new project and add a command button to the form.
Add a reference to "Microsoft ActiveX Data Objects 2.x Library"
Add this code:
VB Code:
Private Sub Command1_Click()
Dim rst As New ADODB.Recordset
Dim cnn As String, strFileName As String, strSQL As String
strFileName = "C:\Temp.mdb"
strSQL = "SELECT * FROM Login"
cnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFileName
rst.Open strSQL, cnn
MsgBox rst!UserName & vbCrLf & rst!Password
Set rst = Nothing
End Sub
Of course change the filename(c:/temp.mdb), tablename(Login), and fieldnames(UserName,Password) to match your database.
That should get you started.
Last edited by Muddy; Jan 28th, 2003 at 10:10 PM.
-
Jan 28th, 2003, 10:14 PM
#4
Member
goto msdn.microsoft.com and do a search on DAO or ADO, ADO preferably. all the simple documentation you need ; )
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
|