C
carrie schmid
users select names using Multipik and click on a print preview button using
the following:
Private Sub cmdChosen_Click()
On Error GoTo Err_cmdChosen_Click
Dim aselected() As Variant
Dim strShowIt As String
Dim varItem As Variant
' added'
Dim prm_MyCtl As Control
Dim DB As Database
Dim rs As Recordset
Dim strDelSQL As String
Set DB = CurrentDb
'Unload the records in the Temp table
strDelSQL = " DELETE tblTemp.fullname FROM tblTemp"
DB.Execute strDelSQL
' Get an array filled with the selected items.
Set prm_MyCtl = Me!lstSelected
Set rs = DB.OpenRecordset("Select * From tblTemp")
aselected = mmp.SelectedItems
For Each varItem In aselected
'added'
rs.AddNew
rs!NAME = varItem
rs.Update
Next varItem
Dim stDocName As String
stDocName = "currencysheetsbyname"
DoCmd.OpenReport stDocName, acPreview
Exit_cmdChosen_Click:
Exit Sub
Err_cmdChosen_Click:
MsgBox Err.Description
Resume Exit_cmdChosen_Click
End Sub
PROBLEM: in 2007 I get "type mismatch".
any assistance would be helpful. thanks. Carrie
the following:
Private Sub cmdChosen_Click()
On Error GoTo Err_cmdChosen_Click
Dim aselected() As Variant
Dim strShowIt As String
Dim varItem As Variant
' added'
Dim prm_MyCtl As Control
Dim DB As Database
Dim rs As Recordset
Dim strDelSQL As String
Set DB = CurrentDb
'Unload the records in the Temp table
strDelSQL = " DELETE tblTemp.fullname FROM tblTemp"
DB.Execute strDelSQL
' Get an array filled with the selected items.
Set prm_MyCtl = Me!lstSelected
Set rs = DB.OpenRecordset("Select * From tblTemp")
aselected = mmp.SelectedItems
For Each varItem In aselected
'added'
rs.AddNew
rs!NAME = varItem
rs.Update
Next varItem
Dim stDocName As String
stDocName = "currencysheetsbyname"
DoCmd.OpenReport stDocName, acPreview
Exit_cmdChosen_Click:
Exit Sub
Err_cmdChosen_Click:
MsgBox Err.Description
Resume Exit_cmdChosen_Click
End Sub
PROBLEM: in 2007 I get "type mismatch".
any assistance would be helpful. thanks. Carrie