![]() |
|
|
#1
|
|||
|
|||
|
Hi
I am quite new to VBA and access 2003 and I know this should be very easy. I am trying to open a record set where the critieria is based on a program variable. For example <statements to provide connection to table> Dim productionrun as string productionrun = "1234" rst.Open "select * from specimendata where runnumber = productionrun ", conn, adOpenForwardOnly, adLockReadOnly I am hopeing this would select all records from the table specimendata where the field runnumber is equal to that of the variable productionrun (in this case 1234). If I substitute productionrun for '1234' it works fine, I just can't seem to pass the variable across. Any ideas on how best to do this. Thanks |
|
#2
|
|||
|
|||
|
You need to move the end quote before your variable.
rst.Open "select * from specimendata where runnumber = " & productionrun, conn, adOpenForwardOnly, adLockReadOnly |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ticketing program for community theater | Bill | Database Design | 1 | 08-12-2009 09:00 PM |
| Passing a value from a variable to an update query | MUKUDU99 | Programming | 0 | 08-24-2008 09:14 PM |
| Variable question | synapse5150 | Programming | 1 | 07-09-2008 06:17 AM |
| Deleting Record Contents, not complete record... | Charles Waters | Access | 2 | 06-24-2008 10:00 AM |
| pass a variable to the MsgBox function | 3dmgirl | Programming | 2 | 04-19-2007 05:14 AM |