B
Bill
In the Sub below, I get the error:
"No value given for one or more required parameters"
on the statement:
rsRoster.Open strSQL, con, adOpenKeyset, adLockOptimistic
What am I missing?
-------------------------------------------------------
Also, I'm not sure about the statement:
rsRoster.Find "[E-mailAddr] = " & Trim(InRec)
Is that a valid method for finding the record within the
recordset?
=============================================
Option Compare Database
Option Explicit
Dim con As ADODB.Connection
Dim rsRoster As ADODB.Recordset
Dim InRec As String
Dim strSQL As String
Public Sub Get_Names_for_badEMAs()
Open "c:\CRS\BadEMAs.txt" For Input As #1 'File of bad e-mail
addresses
Set con = Application.CurrentProject.Connection
strSQL = "Select Lastname, Firstname, e-mailAddr From [ReunionRoster] WHERE
"
strSQL = strSQL & "E-mailAddr = NotNull"
Set rsRoster = CreateObject("ADODB.Recordset")
rsRoster.Open strSQL, con, adOpenKeyset, adLockOptimistic
Line Input #1, InRec 'Get first Record
InRec = Replace(InRec, Chr(9), " ") 'Get rid of any tab
characters
Do While Not EOF(1) ' Loop until end of file.
rsRoster.Find "[E-mailAddr] = " & Trim(InRec)
Debug.Print InRec & " " & rsRoster![LastName] & " " &
rsRoster![FirstName]
Line Input #1, InRec 'Get next record
InRec = Replace(InRec, Chr(9), " ") 'Get rid of any tab
characters
InRec = Trim(InRec)
Loop
Close #1 ' Close file.
rsRoster.Close
Set rsRoster = Nothing
End Sub
"No value given for one or more required parameters"
on the statement:
rsRoster.Open strSQL, con, adOpenKeyset, adLockOptimistic
What am I missing?
-------------------------------------------------------
Also, I'm not sure about the statement:
rsRoster.Find "[E-mailAddr] = " & Trim(InRec)
Is that a valid method for finding the record within the
recordset?
=============================================
Option Compare Database
Option Explicit
Dim con As ADODB.Connection
Dim rsRoster As ADODB.Recordset
Dim InRec As String
Dim strSQL As String
Public Sub Get_Names_for_badEMAs()
Open "c:\CRS\BadEMAs.txt" For Input As #1 'File of bad e-mail
addresses
Set con = Application.CurrentProject.Connection
strSQL = "Select Lastname, Firstname, e-mailAddr From [ReunionRoster] WHERE
"
strSQL = strSQL & "E-mailAddr = NotNull"
Set rsRoster = CreateObject("ADODB.Recordset")
rsRoster.Open strSQL, con, adOpenKeyset, adLockOptimistic
Line Input #1, InRec 'Get first Record
InRec = Replace(InRec, Chr(9), " ") 'Get rid of any tab
characters
Do While Not EOF(1) ' Loop until end of file.
rsRoster.Find "[E-mailAddr] = " & Trim(InRec)
Debug.Print InRec & " " & rsRoster![LastName] & " " &
rsRoster![FirstName]
Line Input #1, InRec 'Get next record
InRec = Replace(InRec, Chr(9), " ") 'Get rid of any tab
characters
InRec = Trim(InRec)
Loop
Close #1 ' Close file.
rsRoster.Close
Set rsRoster = Nothing
End Sub