PDA

Click to See Complete Forum and Search --> : Help writing to a new table with an SQL ...


stmartin
Jul 27th, 1999, 05:34 PM
I'm using an Access database ... what I need to able to do is create another table and populate it with the information I'm selecting.

I have ComboBoxes, being populated with AddNew statements (which comes from a table called Transcripts). I'm doing this with an SQL Select statement .. where StudID is equal to ...whatever .. then the student courses are listed in the ComboBoxes .. Then I need to be able to write what has been selected in the ComboBoxes to a new table (called checksheet) in the database .. I would like to do this with an SQL Statement ...

Any Ideas ?

preeti
Jul 27th, 1999, 05:55 PM
Hi,

Try this:

Dim sSQL As String
Dim cn as Connection (ADO,DAO whichever)

Connect to the database - I will assume that you already know how to do this.

sSQL = "INSERT INTO checksheet (STUDID, COURSE) VALUES('" & cboStudid.text & "', '" _
& cboCourse.text & "')"

cn.execute sSQL

cboStudid.text is the student ID combo box (I assumed that this was declared as string. If it not a string then remove the single quotes)

cboCourse.text is the course combo box.

Hope this helps,

Preeti