| | |
Access and VB
![]() |
•
•
Join Date: Mar 2005
Posts: 18
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by baboon4000
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
kh(bye)
Raza.
hasnainr1@yahoo.co.uk
hasnainr1@hotmail.com
•
•
Join Date: Apr 2005
Posts: 8
Reputation:
Solved Threads: 0
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.
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.
![]() |
Similar Threads
- Disable access to .htaccess (Linux Servers and Apache)
- VB: Connect to Access database via ODBC datasource name (Visual Basic 4 / 5 / 6)
- Writing to an Access Database (Visual Basic 4 / 5 / 6)
- Writing to an Access Database using Java... (Java)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Add a name in the TO: address with code
- Next Thread: Need real time in XP
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





