I tried to create a mysql = in vba, but I get a compile error: Expecting List Separator or )
This is my sql:
Any thoughts one where I am tripping up? I have been debugging for a while now and it seems to work up until the From and then I can't figure out the problem.
Thanks!
misscrf
It is never too late to become what you could have been ~ George Eliot
This is my sql:
Code:
Mysql = " SELECT tblrecord.PKrecordID, tblrecord.txtrecordName, tblCustomer.FKrecordID, " _
& "tblrecord.txtDocketNo, tblrecord.intMatter, " _
& "tblrecordStatus.txtrecordStatus, tblCity.txtCity, tblState.txtState" _
& "IIf([tblSalutation]![txtSalutation] Is Not Null,[tblSalutation]![txtSalutation] & """ _
& """" _
& ",""""" _
& ") & IIf([tblCustomer]![txtFirstName] Is Not Null,[tblCustomer]![txtFirstName] & """ _
& """" _
& ","""""") & IIf([tblCustomer]![txtMiddleInitial] Is Not Null,[tblCustomer]![txtMiddleInitial] & """"" _
& " """ _
& ","") & IIf([tblCustomer]![txtLastName] Is Not Null,[tblCustomer]![txtLastName] & """ _
& """" _
& ","") & IIf([tblSuffix]![txtSuffix] Is Not Null,[tblSuffix]![txtSuffix],"") AS CustomerName, " _
& "tblCustomer.dtDateofBirth, tblCustomerType.txtCustomerType, tblCustomerOrder.dtDateOrder, tblCustomerOrder.intDaysDelivery, " _
& IIf([blTrackingUsed] = -1, """" _
& """Yes""""" _
& " , " _
& """No""""" _
& " ) AS TrackingUsed, tblCustomerOrder.intTrackingFee, tblCustomerOrder.intUsageLength, tblCustomerOrder.dtDateOrder, tblCustomerOrder.dtDateDeliver, tblrecord.txtrecordComments " _
& " FROM tblCity RIGHT JOIN tblrecord ON tblCity.PKCityID = tblrecord.FKCity LEFT JOIN tblState ON tblrecord.FKState = tblState.PKStateID) LEFT JOIN tblrecordStatus ON tblrecord.FKrecordStatus = tblrecordStatus.PKrecordStatusID) LEFT JOIN tblCustomer ON tblrecord.PKrecordID = tblCustomer.FKrecordID) LEFT JOIN tblCustomerOrder ON tblCustomer.PKCustomerID = tblCustomerOrder.FKCustomer) LEFT JOIN tblCustomerType ON tblCustomer.FKCustomerType = tblCustomerType.PKCustomerTypeID) LEFT JOIN tblSalutation ON tblCustomer.FKSalutation = tblSalutation.PKSalutationID) LEFT JOIN tblSuffix ON tblCustomer.FKSuffix = tblSuffix.PKSuffixID Where "
Thanks!
misscrf
It is never too late to become what you could have been ~ George Eliot