|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help with Access to SQL
I have a program written in Access 97. I need to transfer it to SQL tables. I have that part done.
I have a query now, that I need to translate, so to speak. If anyone can help me out, I'd greatly appreciate it. Here's the Access database access code. SELECT DISTINCTROW Table1.PartNumber, Table1.Description, Table1.RevisionLevel, Table1.Status, Table1.MinimumQty, Table1.LotSize, Table1.PartNumberBase, Table2.CustomerPartNumber, DLookUp("[fcompany]","slcdpm","[fcustno] = '" & [Table2].[CustomerNumber] & "'") AS Customer, [Forms]![frmToPrintSearchRequest]![txtCustomerPartNumber] AS frmCPN, [Forms]![frmToPrintSearchRequest]![txtPartNumber] AS frmPN FROM Table1 LEFT JOIN Table2 ON Table1.PartNumber = Table2.PartNumber WHERE (((Table1.PartNumberBase) LIKE [Forms]![frmToPrintSearchRequest]![txtPartNumber] & "*") AND (([Forms]![frmToPrintSearchRequest]![txtCustomerPartNumber]) Is Null) AND (([Forms]![frmToPrintSearchRequest]![txtPartNumber]) Is Not Null)) OR (((Table1.PartNumberBase) Like [Forms]![frmToPrintSearchRequest]![txtPartNumber] & "*") AND ((Table2.CustomerPartNumber) Like "*" & [Forms]![frmToPrintSearchRequest]![txtCustomerPartNumber] & "*") AND (([Forms]![frmToPrintSearchRequest]![txtCustomerPartNumber]) Is Not Null) AND (([Forms]![frmToPrintSearchRequest]![txtPartNumber]) Is Not Null)) OR (((Table2.CustomerPartNumber) Like "*" & [Forms]![frmToPrintSearchRequest]![txtCustomerPartNumber] & "*") AND (([Forms]![frmToPrintSearchRequest]![txtCustomerPartNumber]) Is Not Null) AND (([Forms]![frmToPrintSearchRequest]![txtPartNumber]) Is Null)) ORDER BY Table1.PartNumber; The DLookups are looking up a table on a different database...not that that matters, but I thought I'd just throw that out there. And I'm failry certain that all the conditionals in the WHERE do not need to be there...I think it can be done with just one condition, using LIKE. I got confused mainly around the DLookup, because it is essentially nested queries. And if it makes any difference, I am doing this in Cold Fusion. Thanks a ton. Shawn |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > Help with Access to SQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|