Code to run back end append query

  • Thread starter Thread starter sfraney
  • Start date Start date
S

sfraney

Guest
Hello, I'm trying to create a form with a drop down list that gets populated by a table w/in the DB. That part i have already. Then, I want to populate another table with the infor that gets selected in that drop down list...through an append query. i think i'll have to write some code, not sure. HELP!!
sean
 
You can do something like this....


Private Sub List0_LostFocus()
'*************************************************
'* Procedure: List0_LostFocus()
'* Parameters: none
'* Purpose: Add items selected to an append query
'*************************************************
Dim varItm as Variant

'Loop through each item selected
For Each varItm In List0.ItemsSelected
DoCmd.RunSQL "INSERT INTO TABLE_NAME (FIELD1) " & _
"VALUES(List0.ItemData(varItm)"
Next varItm
End Sub


Hope this helps -db
 

Users who are viewing this thread

Back
Top Bottom