R
Rhys Davies
Hi - i use query by forms a lot. In one instance when i open up a form that
has multiple record lines on it i would like to be able to click on a command
button that would then insert certain information such as userid, firstname,
surnaemet etc into a table, and i need it to do this for each line on the
form i.e. 100 or so. i can do it for a single record in other parts of my
database but i can never quite remember how to loop through and do it for
multiple records. Id imagine i have to open up a recordset and loop through
until i reach the end of file?
here is my code for a single record when the user logs into the database:
Dim strSQL As String
DoCmd.SetWarnings False
strSQL = "INSERT INTO tbluserslogin([userID],[loggedindatetime],[user])" & _
"SELECT" & "'" & useridno & "'," & _
"'" & Now & "', " & _
"'" & loginname & "'"
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
Any help would be great.
Thanks,
Rhys.
has multiple record lines on it i would like to be able to click on a command
button that would then insert certain information such as userid, firstname,
surnaemet etc into a table, and i need it to do this for each line on the
form i.e. 100 or so. i can do it for a single record in other parts of my
database but i can never quite remember how to loop through and do it for
multiple records. Id imagine i have to open up a recordset and loop through
until i reach the end of file?
here is my code for a single record when the user logs into the database:
Dim strSQL As String
DoCmd.SetWarnings False
strSQL = "INSERT INTO tbluserslogin([userID],[loggedindatetime],[user])" & _
"SELECT" & "'" & useridno & "'," & _
"'" & Now & "', " & _
"'" & loginname & "'"
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
Any help would be great.
Thanks,
Rhys.