I have a simple macro that I want to use to pull information from an Access database. Each time I run it, I get the "No value given for one or more required parameters" error. I am wondering if because the Access table is read only that it is somehow affecting the Select statement? I have checked the spelling and columns, and they are correct.
Dim rsData As New ADODB.Recordset
Dim sPath As String
Dim sConnect As String
Dim sSQL As String
Dim PEN_FOFR As String
PEN_FOFR = "V101"
sConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source = C:\Documents and Settings\bmahony\desktop\FOFR Data.mdb;"
sSQL = "Select Salary_Monthly_FT From StaffData_Abra Where PEN=" & PEN_FOFR & ";"
Set rsData = New ADODB.Recordset
rsData.Open sSQL, sConnect, adOpenForwardOnly, adLockReadOnly
If Not rsData.EOF Then
Sheet1.Range("A1").Value = "No staff found"
Set rsData = Nothing