Results 1 to 3 of 3

Thread: Trying to get 1 record to reference another on the same table in a Module

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Posts
    4

    Question Trying to get 1 record to reference another on the same table in a Module

    I'm trying to write a module in Access 97 that takes a record that is predefined, compares it to a table, finds a corresponding record on that table and displays that corresponding record as my result.

    My table (named "Records")looks like this:

    Table name: Records
    Code:
    Predefined  | Corresponding
    A                    B

    I thought I could do this using SELECT FROM & WHERE, but I think I've been going about this all wrong. Here's what I've been trying to get work:

    Code:
    Private Sub Test1_Click()
    
        Dim myrecord As String
        
        myrecord = "SELECT tblRecords.Corresponding FROM tblRecords WHERE tblRecords.Predefined = A"
        
                          
        MsgBox ([myrecord])
        
        Exit Sub
    I want B as a result but all that I'm getting as the result in my Message Box is "SELECT tblRecords.Corresponding FROM tblRecords WHERE tblRecords.Predefined = A " and not the record I was looking for.

    What am I doing wrong? Am I going about this the completely wrong way?
    Last edited by mehmet; Aug 30th, 2004 at 02:00 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width