|
-
Feb 5th, 2000, 12:31 PM
#1
Thread Starter
New Member
I am in the middle of making a Daily Production Report DB for my business & I have setup my db to record the daily output for each shift
I have setup 1 table & 150 fields within it to make the job abit easier. I need to do a part number search so my data control will place the searched for data into a dbgrid..
I've tried many ways & many places to find a multi-field search SQL cod ethat will work the way I need it..
I've tried the following code to no avail:
Private Sub Command1_Click()
grid.Data1.RecordSource = "SELECT Info.PartNumber1, Info.PartNumber2, Info.PartNumber3, Info.PartNumber4, Info.PartNumber5, Info.PartNumber6, Info.PartNumber7, Info.PartNumber8, Info.PartNumber9, Info.PartNumber10, Info.PartNumber11, Info.PartNumber12 From Info where Info.PartNumber1, Info.PartNumber2, Info.PartNumber3, Info.PartNumber4, Info.PartNumber5, Info.PartNumber6, Info.PartNumber7, Info.PartNumber8, Info.PartNumber9, Info.PartNumber10, Info.PartNumber11, Info.PartNumber12 = '" & txtTargetName.Text & "'"
grid.Data1.Refresh
Unload Me
End Sub
'
I am using a extbox for user input, if anyone would happen to know how I can help me fix this SQL delema I would be most apreciated.. Thank you..
------------------
~\*/~ Thank you....
-
Feb 6th, 2000, 07:04 AM
#2
Guru
A few things here:
1) you want to set the data1.recordsource to your SQL statement, not Grid.data1.recordsource
2) Based on your table, your sql will have to be something like:
"Select * from MyTable where Part1 = '" & text1.text & "' OR Part2 = '" & text1.text & "' OR ".......................
3) The reason your query is so complex is because your table is probably not properly normalized, but that's another topic.
HTH
Tom
-
Feb 6th, 2000, 04:38 PM
#3
Junior Member
Remeber that in your sql statement you must put the correct brackets when using multiple OR statements in sql ie
SELECT * FROM atable WHERE (something = ? OR something = ? OR something = ? OR something = ?) etc
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|