Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding to Recordset using ADO not working.....HELP 2

Status
Not open for further replies.

homesick

Programmer
Dec 5, 2001
55
0
0
CA
This is what i have....i am using ado, but my connection is already bound using the properties box....is that ok or do i have to connect it using code...also, how do i know what provider i am using? i am using the built in DB in Visual Basic 6, does that make a diffrence? Striving to understand......



Private Sub Command1_Click()


Dim aname As String
Dim cname As String

msg = "This record will be added as a sale"
Style = vbOKCancel + vbQuestion + vbDefaultButton1
resonse = MsgBox(msg, Style, "Sale Confirmation")
If response = vbOK Then
tracker.AddNew
tracker!aname = straname
tracker!cname = strcname
tracker.Update

End If
If response = vbCancel Then
Combo5.SetFocus
End If

End Sub
 
You might want design a class based on your Database. The initialization and termination methods are excellent places for making and dropping the connection.

In the database class focus on making the database work and create an intuitive interface that that is easy to use in your main line of the application. Kind of like designing your own language.

Wouldn't it be nice to be able to code:
[tt]
Private Command1_Click()
MsgBox IIf(oMyDb.Tracker.AddNew("NewName"), _
"Record Added", _
"Add Failed")
End Sub
[/tt]
instead of that 16-17 line process in any event function you wanted .


Wil Mead
wmead@optonline.net

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top