Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 substitution variables

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-11-13 : 19:34:11
alan writes "The bit of code below does work, to interrogate an Access database using VB6.
However, that's because the line that begins SQLQuery is told which field (tmax) in
the database to search in.

Private Sub Command1_Click()
Dim Checknumb As Integer
List1.Clear
Checknumb = Val(Text2.Text)
SQLQuery = "tmax LIKE '*" & Checknumb & "*'"
rsrdate.FindFirst SQLQuery

However, I want users to choose a field from a list provided (possibly using a combo
box) and just write one bit of code for all options, by passing the user's choice to a
substitution variable. But I can't find how they work. I tried the line -
SQLQuery = "&variate LIKE '*" & Checknumb & "*'"
- with the ampersand indicating that it's a substitution variable, but that didn't work.

(I use Win NT 4)"
   

- Advertisement -