here is some code i have written to add items to a table on the click of a button on a form.
===========================================
Private Sub Creerbtn_click()
Dim strSQL as string
Dim no_res as integer
Dim nom as string
dim prenom as string
dim etudiant_ouinon as string
etc..
me.resnumberscbo.value = no_res
me.nomtxt.text= nom
me.prenomtxt.text= prenom
me.etudiantlst.text= etudiant_ouinon
me.chambrenumerocbo.value = no_chambre
etc...
strSQL = "INSERT INTO residents VALUES('no_res', 'prenom', 'nom'," & _
"'no_chambre', 'etudiant_ouinon', 'admin_ouinon', 'date_naissance'," & _
"'annee_etude', 'address', 'codepostale', 'localite', 'pays')"
DoCmd.RunSQL strSQL
End Sub
===========================================
what im trying to do, is when the button is clicked:
1.) it runs the INSERT INTO query to add data to the table RESIDENTS which i have created beforehand.
2.) the values are being entered in textfields in a form, by a user.
3.) im trying to get those values from the txtboxes into the sql string so that it adds them to the table RESIDENTS.
does the code seem right?
===========================================
Private Sub Creerbtn_click()
Dim strSQL as string
Dim no_res as integer
Dim nom as string
dim prenom as string
dim etudiant_ouinon as string
etc..
me.resnumberscbo.value = no_res
me.nomtxt.text= nom
me.prenomtxt.text= prenom
me.etudiantlst.text= etudiant_ouinon
me.chambrenumerocbo.value = no_chambre
etc...
strSQL = "INSERT INTO residents VALUES('no_res', 'prenom', 'nom'," & _
"'no_chambre', 'etudiant_ouinon', 'admin_ouinon', 'date_naissance'," & _
"'annee_etude', 'address', 'codepostale', 'localite', 'pays')"
DoCmd.RunSQL strSQL
End Sub
===========================================
what im trying to do, is when the button is clicked:
1.) it runs the INSERT INTO query to add data to the table RESIDENTS which i have created beforehand.
2.) the values are being entered in textfields in a form, by a user.
3.) im trying to get those values from the txtboxes into the sql string so that it adds them to the table RESIDENTS.
does the code seem right?