Steve,
Yep, that looks fine.
Just to make you aware though; you can use line-continuation characters to
make the code more readable.
A line-continuation character is an underscore, which tells Access that the
following line is part of the same line. You have to use it in conjunction
with the & character; for example:
sSQL = "SELECT tblissueReceive.Saw_ID, [Mill_ID] & [Bandsaw_Type] AS Expr1 "
& _
"FROM tblsawinventory " & _
"INNER JOIN tblIssueReceive " & _
"ON tblSawInventory.Saw_ID = tblIssueReceive.Saw_ID " & _
"WHERE(((tblIssueReceive.Date_Issued) Is Not Null) " & _
"AND ((tblIssueReceive.Date_Returned) Is Null) " & _
"AND ((tblIssueReceive.Saw_ID) LIKE "
You're better to check Help, but I think you can use up to 20
line-continuations at a time.
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
Steve said:
Graham,
After playing with it a little more, I came up with this code and it worked:
Dim sSQL As String
sSQL = "Select tblissueReceive.Saw_ID, [Mill_ID]"
sSQL = sSQL & " & [Bandsaw_Type] AS Expr1"
sSQL = sSQL & " From tblsawinventory Inner Join tblIssueReceive ON
tblSawInventory.Saw_ID = tblIssueReceive.Saw_ID"
sSQL = sSQL & " WHERE(((tblIssueReceive.Date_Issued) Is Not Null)
AND ((tblIssueReceive.Date_Returned) Is Null)"
sSQL = sSQL & " AND ((tblIssueReceive.Saw_ID) like "
Select Case Me!SawFilter.Value
Case 1: sSQL = sSQL & Chr$(34) & "BH*" & Chr$(34) & ")) ORDER BY tblIssueReceive.Saw_ID"
Thank you for helping me out. Would you say this was the correct way to do it?
Steve
Steve said:
Graham,
I tried what you were saying and here is my code:
Dim sSQL As String
Select Case Me!SawFilter.Value
Case 1: sSQL = "SELECT tblIssueReceive.Saw_ID, [Mill_ID] & " " &
[Bandsaw_Type] AS Expr1, tblIssueReceive.Date_Issued,
tblIssueReceive.Date_Returned FROM tblSawInventory INNER JOIN
tblIssueReceive ON tblSawInventory.Saw_ID=tblIssueReceive.Saw_ID WHERE
(((tblIssueReceive.Date_Issued) Is Not Null) AND
((tblIssueReceive.Date_Returned) Is Null) AND ((tblIssueReceive.Saw_ID) like
"BH*")) ORDER BY tblIssueReceive.Saw_ID"it highlights from my &" "& to the end of the line. Do you have any ideas
to what I am doing wrong?