this is ganna sound so weired. do anyone happend to have any worksheet about access and vb, and creating database, please send me a private email on yahoo, tansk

Recommended Answers

All 4 Replies

Hi,
I don't know exactly what you want to do here.
Do you want to create a database or table using vb?

If thats the case, I think you can make are reference first to ms access 8.0 if your using access97 then create an object...

It's really hard to guess but hope it gives you some help.


Newvbguy

Hi, do you wnat to just access and an "access" database using vb, or create your own in vb?
which versions are you using?

this is ganna sound so weired. do anyone happend to have any worksheet about access and vb, and creating database, please send me a private email on yahoo, tansk

its looking that u need to create database on ms access (2000) and wan to connect forms with it...u can choose ODBC (control panel --> Admins. Tools --> ODBC) and then write file source...use wizards in VB 6..it will be easier for u
kh(bye)

Raza.
hasnainr1@yahoo.co.uk
hasnainr1@hotmail.com

First go to access and creat a database for example database name is "Test". Then creat a table having some name for example "Invoice_info", having some field according to ur requirment.
Then come on to VB6 and select VB Enterprise Control Application form place as many textboxes as u've fields in ur table.
For example ur table has 4 fields
invoice(string)
Name(String)
Date(dateandtime type)
Amount(Number)
Create 4 textboxes for each field. And 2 command buttons 1 for save the record and 1 for retreive the record.
Then past Adodc on ur VB Form. and palces these lines of code
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Test.mdb;Persist Security Info=False"
End Sub

Private Sub retrieve_Click()
Unload Form1
Load Form1
Form1.Show

Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "Invoice_info"
Adodc1.Refresh


Text1.Text = Adodc1.Recordset.Fields(0)
Text2.Text = Adodc1.Recordset.Fields(1)
Text3.Text = Adodc1.Recordset.Fields(2)
Text4.Text = Adodc1.Recordset.Fields(3)


End Sub

Private Sub save_Click()
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "Invoice_info"
Adodc1.Refresh

Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields(0) = Text1.Text
Adodc1.Recordset.Fields(1) = Text2.Text
Adodc1.Recordset.Fields(2) = Text3.Text
Adodc1.Recordset.Fields(3) = Val(Text4.Text)
Adodc1.Recordset.Update
Unload Form1
Load Form1
Form1.Show
End Sub

Note that the database must be at the location where the VB application is. Means the VB application and Access Data base must be in same folder.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.