The long SQL statement in
probably looked a bit scary. By far the easiest way to get complex SQL statements right is to use the Microsoft Access query builder. You graphically select the tables you are interested in. Access then automatically links the tables. Notice the 1-to-many relationships. You can then easily run your queries and see the output right in Access. This gives you a quick and easy way to get complex SQL statements right. You can immediately see the results.buildID3
Once the data returned is correct, simply select View-SQL View from the menu and you can see the statement that Access used to generate your output. A quick cut and paste and you have your SQL statement. The only thing left to do is 'stringize' it and add the variables you wish that specify the
clause. This alone is well worth the price of Access.WHERE
And as a note, whenever you are concatenating strings, always use the
character. Yes, the &
will work, but that also works for math. When we say 2 + 2, VB knows this will be a math operation. However, if we say +
, VB first has to figure out if this is a math operation or a string operation. Not only can you get unpredictable results in many cases, it is just plain slower. So whenever you need to concatenate two strings, always use the "Hello " + "World"
character.&