Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2002
    Location
    San Antonio, TX
    Posts
    69

    Exclamation Unanswered: A97 recordset help

    I'm having a problem with a query returning no records based off a value from a control on an open form. Here's my relevant code:

    strSQL = "SELECT * FROM tblData WHERE (((tblData.PID)=" & Chr(34) & "Forms![frmAddressChange]![ctlPID]" & Chr(34) & "));"

    Set rec = CurrentDb.OpenRecordset(strSQL)

    The above returns no records however, if I hardcode a value, such as:

    strSQL = "SELECT * FROM tblData WHERE (((tblData.PID)=" & Chr(34) & "082128" & Chr(34) & "));"

    Set rec = CurrentDb.OpenRecordset(strSQL)

    it returns a recordset populated with the appropriate information.

    Can anyone give me some direction as to what I'm doing wrong?

    Many thanks in advance.
    "Doing stuff is overrated. Take Hitler for example. He did lots but don't we all wish he'd have just stayed home and gotten stoned?"

  2. #2
    Join Date
    Nov 2001
    Posts
    336
    May be:

    strSQL = "SELECT * FROM tblData WHERE (((tblData.PID)='" & Forms![frmAddressChange].[ctlPID] & "'));"

    Igor

  3. #3
    Join Date
    Feb 2002
    Location
    San Antonio, TX
    Posts
    69
    That did it.

    Thanks amigo.
    "Doing stuff is overrated. Take Hitler for example. He did lots but don't we all wish he'd have just stayed home and gotten stoned?"

Posting Permissions

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