Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2010
    Posts
    2

    Question Unanswered: Odd Run-time error '3021'

    Hey all, I have limited knowledge of VB and especially its use in Access, and I'm getting a weird error.

    Code:
    Option Compare Database
    Private blpdatactrl As BBControl
    
    Sub blp()
    	If blpdatactrl Is Nothing Then Set blpdatactrl = New BBControl
    	blpdatactrl.RequestData "SELECT lookup, cookie FROM Security", "BlpResults"
    End Sub
    The line that gets highlighted when I get the error is { blpdatactrl.RequestData "SELECT lookup, cookie FROM Security", "BlpResults" }, but here's the weird part: the function getting called asks for two strings.

    Code:
    Public Sub RequestData(SecurityListInit As String, TableNameInit As String)
    How can there be "No current record." for a string?

  2. #2
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    Code:
    blpdatactrl.RequestData "SELECT lookup, cookie FROM Security", "BlpResults"
    I would suggest that the SELECT statement might be coming up empty handed (in other words, null), so when Access tries to feed it into the sub's first argument it comes up with "No Current Record."

    Try proving that your SELECT statement isn't coming up with valid data.

    Sam

  3. #3
    Join Date
    Mar 2010
    Posts
    2
    I know for a fact that the table being queried is populated with data.

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    In the VBA Editor, select Options from the Tools menu, then on the General tab check Break in Class Module or Break on All errors, and run the program again. That way you'll be able to see where the error really occurs.
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •