mehmet
Aug 30th, 2004, 01:56 PM
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
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:
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?
My table (named "Records")looks like this:
Table name: Records
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:
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?