troubleshooting Question

Opening table in Access database

Avatar of Al
Al asked on
Visual Basic Classic
3 Comments1 Solution270 ViewsLast Modified:

I doing a simple connetion to access database.
I open main table1.
then I open table2 in the same database with a sql but in doing so, I am gettig following error

"No Value give for one or more parameters."   Any idea?

Public Sub TransferExcelFile2Database_Click()
 Set cnhrda = New ADODB.Connection
 cnhrda.CursorLocation = adUseClient
 cnhrda.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.path & "\BE_Tracker.mdb;"

' Open main table
 Dim rsmdb As ADODB.Recordset
 Set rsmdb = New ADODB.Recordset
 rsmdb.Open "Select * from Main_Records", cnhrda, adOpenStatic, adLockOptimistic
    While Not rs.EOF
        With rsmdb
        ' Staus is Issue/Open/Cancelled

'2)  read second table        
    Dim sSql As String
    Dim rsTemp As ADODB.Recordset
    Set rsTemp = New ADODB.Recordset
    sSql = "Select Staus_ID from LKP_Status where Status_name=""" & rs!Status & """"
     rsTemp.Open sSql, cnhrda, adOpenStatic, adLockReadOnly
'                ^---I get error here.   "No Value give for one or more parameters."   Any idea?

    If Not rsTemp.EOF Then
        !Status = rsTemp!Status_ID
    End If
      '  !Status = getStatus(rs!Status)
        !Name = rs!Name
        !address = rs!address
        !age = rs!age
        End With
    MsgBox "completed"
End Sub    
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros