I prepared a simple database in ms excel. Now I want to link it with ms visual basic 6.0. I want to enter data in ms visual basic form and it will update my excel database/ spreadsheet. How to link a record in ms excel with visual basic 6.0 ? And How to enter data on visual basic from?

Plz help me, ...anyone


Regards
S.N.Mazumder Amit

Okay, there is more than one way in which to use excel with visual basic 6.0. Now, you said as a database so you will need to use your friends (yahoo, google, ask, answers, bing) and search for vb6 ado tutorial. Then see http://www.connectionstrings.com for a DNS LESS connection string that you will need for your ADO connection.

Also, you could use your friends to search for vb6 automating excel tutorial...

Good Luck

How to link or connect MS Access 2003 database with MS Visual Basic 6.0 for creating salary sheet?

Please anyone help me in datails. Or suggest me, Which verson of visual basic I can use as a beginner in programming side.

From
Amit

How to link or connect MS Access 2003 database with MS Visual Basic 6.0 for creating salary sheet?

Please anyone help me in datails. Or suggest me, Which verson of visual basic I can use as a beginner in programming side.

From
Amit

I can tell you a very simple way. like:
put a data control in your form. go to data control properties. select database name and then select the record source ( table name).
one thing you need service pack 6 (vb) for use office 2003.
you can use visual basic 6

I did the work before that you advised. But when I click on record source the following message is shown: unrecognized database format ' E\Salary in Access.mdb'.
I use MS Access 2003 and MS Visual Basic 6.0. Isn't it possible?

Now what problem may arise here? Plz suggest me anyone.

u need service pack 6 of vb6. download it from Microsoft site.

how to connect VB6.0 to MS Excel 2003

venice yu, please read our posting rules HERE. We do not allow the "theft" of others posts here on Daniweb.:)

Please open your own thread (at the top of the forum page) and we will gladly help you from there.;) I will not post a solution on this post.

'Check this out. VB6 interact with Excel

Dim xl As excel.Application
Dim sAmount As String
Private Function getTotalSales()
sAmount = Str(xl.ActiveSheet.Range("SalesTotal").Value)
Label1.Caption = "Total Sales: " & "P " & Trim$(FormatNumber(sAmount))
Text3.Text = Str(xl.ActiveSheet.Range("JanSales").Value)
Text2.Text = Str(xl.ActiveSheet.Range("FebSales").Value)
Text1.Text = Str(xl.ActiveSheet.Range("MarSales").Value)
End Function

Private Sub Command1_Click()
xl.Visible = True
End Sub

Private Sub Command2_Click()
tsentry = Val(txtJan) + Val(txtFeb) + Val(txtMar)
MsgBox ("P" & FormatNumber(tsentry) & " sales added.")

xl.ActiveSheet.Range("JanSales").Value = (xl.ActiveSheet.Range("JanSales").Value) + Val(txtJan.Text)
xl.ActiveSheet.Range("FebSales").Value = (xl.ActiveSheet.Range("FebSales").Value) + Val(txtFeb.Text)
xl.ActiveSheet.Range("MarSales").Value = (xl.ActiveSheet.Range("MarSales").Value) + Val(txtMar.Text)
txtJan.Text = ""
txtFeb.Text = ""
txtMar.Text = ""
getTotalSales

End Sub

Private Sub Command2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Command2.Font.Bold = True Then
Command2.Font.Bold = False
Else
Command2.Font.Bold = True
End If
End Sub


Private Sub Command4_Click()
xl.ActiveWorkbook.PrintOut
End Sub


Private Sub Form_Load()
Set xl = CreateObject("Excel.Application")
xl.Workbooks.Open (App.Path & "\Sales.xls")

getTotalSales

End Sub

Private Sub Form_Unload(Cancel As Integer)

xl.ActiveWorkbook.Save
xl.Quit
Set xl = Nothing

End Sub
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.