S
Stu Kennedy
I have a selection form that moves info from one list box to another and I
need to add the data from the second box to an existing table, then go to
another form. Here is the code I have, but I don't know how to append the
fields from the list box to my existing table:
Private Sub OK_Click()
Dim CurDB As Database, SelectPhys As Database, Rs As Recordset, Rs1 As
Recordset, SQLStmt As String, SQLStmt1 As String
Dim SelPhys As String
SelPhys = ""
Set CurDB = CurrentDb()
Set SelectPhys = SelectedPhysicianstoprocess
SQLStmt = "SELECT [PHYS_CODE],[PHYS_NAME] from [phys_name_select] where
[PHYS_SELECTED] = True ORDER BY [PHYS_CODE]"
Set Rs = CurDB.OpenRecordset(SQLStmt, DB_OPEN_DYNASET)
Set Rs1 = SelectPhys.OpenRecordset(Rs1, DB_Append_Only)
Do While Not Rs.EOF
SelPhys = SelPhys & Rs("PHYS_CODE") & " "
Rs.MoveNext
Fields.Append PHYS_CODE, Text
Fields.Append PHYS_NAME, Text
Loop
Rs.Close
End Sub
any and all help is greatly appreciated!
need to add the data from the second box to an existing table, then go to
another form. Here is the code I have, but I don't know how to append the
fields from the list box to my existing table:
Private Sub OK_Click()
Dim CurDB As Database, SelectPhys As Database, Rs As Recordset, Rs1 As
Recordset, SQLStmt As String, SQLStmt1 As String
Dim SelPhys As String
SelPhys = ""
Set CurDB = CurrentDb()
Set SelectPhys = SelectedPhysicianstoprocess
SQLStmt = "SELECT [PHYS_CODE],[PHYS_NAME] from [phys_name_select] where
[PHYS_SELECTED] = True ORDER BY [PHYS_CODE]"
Set Rs = CurDB.OpenRecordset(SQLStmt, DB_OPEN_DYNASET)
Set Rs1 = SelectPhys.OpenRecordset(Rs1, DB_Append_Only)
Do While Not Rs.EOF
SelPhys = SelPhys & Rs("PHYS_CODE") & " "
Rs.MoveNext
Fields.Append PHYS_CODE, Text
Fields.Append PHYS_NAME, Text
Loop
Rs.Close
End Sub
any and all help is greatly appreciated!