PDA

Click to See Complete Forum and Search --> : New To DB


PRIVATE1
Sep 1st, 2000, 10:07 PM
I have a Microsoft Access Version 7 Dtabase Called "Users"
Inside it is 1 Table with 2 fields 1 called "Nick" the other called "IPNumber" I have 2 text boxes that are linked to it on the form . The question is how can I add the text in those 2 boxes to the apropriate Feild in it Through Code ? I Can't have the user enter it manually . I nned basicaly an On Click add this user and IP to the DB .
Any Help would be appreciated . Thanks guys

[]Private[]

sanon
Sep 2nd, 2000, 02:29 AM
******** A brief sample how to display data in textboxes

sql = "select user,ip from table_name"
rs.open sql, objconnection

txtUser.text = rs!user
txtIP.text = rs!ip

******** How to insert a new record into the DB

private sub cmdAdd_click()
sql = "insert into table_name (user,ip) " _
& "values('" & txtUser.text & "'," _
& txtIP.text & ")"
objcommand.commandtext = sql
objcommand.commandtype = adcmdtext
objcommand.activeconnection = objconnection
objcommand.execute

Hope you got an idea...

PRIVATE1
Sep 2nd, 2000, 07:00 AM
Thanks For the tip .