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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need some advice on FAQs

Status
Not open for further replies.

ribhead

Technical User
Jun 2, 2003
384
US
I have been struggling with how to update a table in an external database and I found a really easy way to do it (for me anyway) and I'm wondering if it would be worthy of a FAQ. I've never written one and perhaps it just outright sucks but below is what I have. Please let me know if it's worthy.

Private Sub cmdsubmit_Click()
'This program will insert data in to the name and pass fields in the tbltooling table _
located on the user's P drive. First the user must establish a reference to the _
DAO object model. _
Do this by left clicking Tools-->Left clicking References--> Then find the _
reference that says Microsoft DAO 3.X Object Library--> Select the box and left click OK.
'Note: The "X" after 3. represents a number that may be different for each user.

Dim dbs As Database, strdb As String, strSQL As String
Dim strname As String, strpass As String 'These variables will hold the _
values that will be sent to our database.
strname = Me.tbname.Value 'Person's name
strpass = Me.tbpassword.Value 'Person's password
strdb = "P:\Toolroom\ToolRoom.mdb" 'Insert the path to your Access database
Set dbs = OpenDatabase(strdb)
strSQL = "INSERT INTO tbltooling1 ([pass],[name])" _
& " VALUES('" & strpass & "','" & strname & "');"
dbs.Execute (strSQL)
dbs.Close
End Sub

Just wondering

[reading]

Rib

Bartender:Hey aren't you that rope I threw out an hour ago?

Rope:No, I'm afraid knot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top