dbTalk Databases Forums  

help in query!

comp.databases.pick comp.databases.pick


Discuss help in query! in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
kanthi
 
Posts: n/a

Default help in query! - 03-22-2006 , 09:14 AM






hi,

i was trying to compare an attribute (DTPanel ) of Testtable for 4
vehicles of a particular OEM,Vehicle model and model year.......


i just started off with this code...am not sure how to frame the
query....could anyone help me on th same.....am a beginner


Option Compare Database


On Error GoTo ProcError


Dim strValueList$
Dim rs As DAO.Recordset
Dim strSQL As String, strTemp As String
Dim i As Integer
Dim count As Integer


i = 0


If chkIncludeDTPanel.Value = -1 Then


strSQL = "SELECT DTPanel FROM TestTable INNER JOIN VehicleTable" & _
" ON TestTable.DoorTrimPanelID =
VehicleTable.DoorTrimPanelID" & _
" WHERE VehicleTable.OEM = """ & Me.cboOEM.Column(1) &
"""" & _
" AND VehicleTable.VehicleModel = """ &
Me.CboVehicleModel.Column(1) & """" & _
" AND VehicleTable.ModelYear = " &
Me.cboModelYear.Column(1) & """" & _
" AND VehicleTable.OEM = """ & Me.CboOEM2.Column(1) &
"""" & _
" AND VehicleTable.VehicleModel = """ &
Me.CboVehicleModel2.Column(1) & """" & _
" AND VehicleTable.ModelYear = " &
Me.CboModelYear2.Column(1) & """" & _
" AND VehicleTable.OEM = """ & Me.CboOEM3.Column(1) &
"""" & _
" AND VehicleTable.VehicleModel = """ &
Me.CboVehicleModel3.Column(1) & """" & _
" AND VehicleTable.ModelYear = " &
Me.CboModelYear3.Column(1) & """" & _
" AND VehicleTable.OEM = """ & Me.CboOEM4.Column(1) &
"""" & _
" AND VehicleTable.VehicleModel = """ &
Me.CboVehicleModel4.Column(1) & """" & _
" AND VehicleTable.ModelYear = " &
Me.CboModelYear4.Column(1)


Set rs = CurrentDb.OpenRecordset(strSQL)


If Not rs.EOF Then
rs.MoveFirst
Do Until rs.EOF
i = 0
count = rs.Fields.count - 1
For i = 0 To count
strTemp = strTemp & rs.Fields(i).Name & ": " &
rs.Fields(i) & " "
Next i
rs.MoveNext
Loop
Else
MsgBox "No Records"
End If
End If


txtResults.Value = strTemp


ExitProc:
' Cleanup
On Error Resume Next
rs.Close: Set rs = Nothing
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure cmdPerformSearch_Click..."
Resume ExitProc
End Sub


Reply With Quote
  #2  
Old   
panzerboy@gmail.com
 
Posts: n/a

Default Re: help in query! - 03-22-2006 , 03:02 PM






Im no SQL expert so I cant comment on that, one thing puzzles me
though.
Your line ...

strTemp = strTemp & rs.Fields(i).Name & ": " &
rs.Fields(i) & " "

Is this a string concantenation?
With any version of Pick I know string cats are done by using the colon
thus...

strTemp = strTemp : rs.Fields(i).Name : ":" : rs.Fields(i) : " "

or even

strTemp := rs.Fields(i).Name : ":" : rs.Fields(i) : " "

Uisng the & in 'normal' lanuagues is a binary AND (as apposed to && the
logical).
In my version of Pick (D3) the & is a logical AND thus CRT (21 & 38)
gives 1 not 4
(010101 & 100110 = 000100)

Jeremy Thomson


Reply With Quote
  #3  
Old   
Peter McMurray
 
Posts: n/a

Default Re: help in query! - 03-22-2006 , 07:45 PM



Hi
I am at a loss to understand why you would not use Pick Basic and
AQL/English/Recall depending on which MV platform you are running.
Certainly something like
SSELECT TESTABLE BY DTPANEL WITH OEM = "1" "2" "3" "4" AND WITH MODEL ="1"
"2" "3" "4" AND WITH YEAR "2006"
seems a heck of a lot easier than all that SQL
Regards
Peter McMurray
"kanthi" <kanthir (AT) gmail (DOT) com> wrote

Quote:
hi,

i was trying to compare an attribute (DTPanel ) of Testtable for 4
vehicles of a particular OEM,Vehicle model and model year.......


i just started off with this code...am not sure how to frame the
query....could anyone help me on th same.....am a beginner


Option Compare Database


On Error GoTo ProcError


Dim strValueList$
Dim rs As DAO.Recordset
Dim strSQL As String, strTemp As String
Dim i As Integer
Dim count As Integer


i = 0


If chkIncludeDTPanel.Value = -1 Then


strSQL = "SELECT DTPanel FROM TestTable INNER JOIN VehicleTable" & _
" ON TestTable.DoorTrimPanelID =
VehicleTable.DoorTrimPanelID" & _
" WHERE VehicleTable.OEM = """ & Me.cboOEM.Column(1) &
"""" & _
" AND VehicleTable.VehicleModel = """ &
Me.CboVehicleModel.Column(1) & """" & _
" AND VehicleTable.ModelYear = " &
Me.cboModelYear.Column(1) & """" & _
" AND VehicleTable.OEM = """ & Me.CboOEM2.Column(1) &
"""" & _
" AND VehicleTable.VehicleModel = """ &
Me.CboVehicleModel2.Column(1) & """" & _
" AND VehicleTable.ModelYear = " &
Me.CboModelYear2.Column(1) & """" & _
" AND VehicleTable.OEM = """ & Me.CboOEM3.Column(1) &
"""" & _
" AND VehicleTable.VehicleModel = """ &
Me.CboVehicleModel3.Column(1) & """" & _
" AND VehicleTable.ModelYear = " &
Me.CboModelYear3.Column(1) & """" & _
" AND VehicleTable.OEM = """ & Me.CboOEM4.Column(1) &
"""" & _
" AND VehicleTable.VehicleModel = """ &
Me.CboVehicleModel4.Column(1) & """" & _
" AND VehicleTable.ModelYear = " &
Me.CboModelYear4.Column(1)


Set rs = CurrentDb.OpenRecordset(strSQL)


If Not rs.EOF Then
rs.MoveFirst
Do Until rs.EOF
i = 0
count = rs.Fields.count - 1
For i = 0 To count
strTemp = strTemp & rs.Fields(i).Name & ": " &
rs.Fields(i) & " "
Next i
rs.MoveNext
Loop
Else
MsgBox "No Records"
End If
End If


txtResults.Value = strTemp


ExitProc:
' Cleanup
On Error Resume Next
rs.Close: Set rs = Nothing
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure cmdPerformSearch_Click..."
Resume ExitProc
End Sub




Reply With Quote
  #4  
Old   
Dave Goldfinch
 
Posts: n/a

Default Re: help in query! - 03-23-2006 , 07:00 PM




Because he has moved on from green screen and is developing in VB !

On Thu, 23 Mar 2006 01:45:01 GMT, "Peter McMurray"
<excalibur21 (AT) bigpond (DOT) com> wrote:

Quote:
Hi
I am at a loss to understand why you would not use Pick Basic and
AQL/English/Recall depending on which MV platform you are running.
Certainly something like
SSELECT TESTABLE BY DTPANEL WITH OEM = "1" "2" "3" "4" AND WITH MODEL ="1"
"2" "3" "4" AND WITH YEAR "2006"
seems a heck of a lot easier than all that SQL
Regards
Peter McMurray
"kanthi" <kanthir (AT) gmail (DOT) com> wrote in message
news:1143040443.100302.83220 (AT) u72g2000cwu (DOT) googlegroups.com...
hi,

i was trying to compare an attribute (DTPanel ) of Testtable for 4
vehicles of a particular OEM,Vehicle model and model year.......


i just started off with this code...am not sure how to frame the
query....could anyone help me on th same.....am a beginner


Option Compare Database


On Error GoTo ProcError


Dim strValueList$
Dim rs As DAO.Recordset
Dim strSQL As String, strTemp As String
Dim i As Integer
Dim count As Integer


i = 0


If chkIncludeDTPanel.Value = -1 Then


strSQL = "SELECT DTPanel FROM TestTable INNER JOIN VehicleTable" & _
" ON TestTable.DoorTrimPanelID =
VehicleTable.DoorTrimPanelID" & _
" WHERE VehicleTable.OEM = """ & Me.cboOEM.Column(1) &
"""" & _
" AND VehicleTable.VehicleModel = """ &
Me.CboVehicleModel.Column(1) & """" & _
" AND VehicleTable.ModelYear = " &
Me.cboModelYear.Column(1) & """" & _
" AND VehicleTable.OEM = """ & Me.CboOEM2.Column(1) &
"""" & _
" AND VehicleTable.VehicleModel = """ &
Me.CboVehicleModel2.Column(1) & """" & _
" AND VehicleTable.ModelYear = " &
Me.CboModelYear2.Column(1) & """" & _
" AND VehicleTable.OEM = """ & Me.CboOEM3.Column(1) &
"""" & _
" AND VehicleTable.VehicleModel = """ &
Me.CboVehicleModel3.Column(1) & """" & _
" AND VehicleTable.ModelYear = " &
Me.CboModelYear3.Column(1) & """" & _
" AND VehicleTable.OEM = """ & Me.CboOEM4.Column(1) &
"""" & _
" AND VehicleTable.VehicleModel = """ &
Me.CboVehicleModel4.Column(1) & """" & _
" AND VehicleTable.ModelYear = " &
Me.CboModelYear4.Column(1)


Set rs = CurrentDb.OpenRecordset(strSQL)


If Not rs.EOF Then
rs.MoveFirst
Do Until rs.EOF
i = 0
count = rs.Fields.count - 1
For i = 0 To count
strTemp = strTemp & rs.Fields(i).Name & ": " &
rs.Fields(i) & " "
Next i
rs.MoveNext
Loop
Else
MsgBox "No Records"
End If
End If


txtResults.Value = strTemp


ExitProc:
' Cleanup
On Error Resume Next
rs.Close: Set rs = Nothing
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure cmdPerformSearch_Click..."
Resume ExitProc
End Sub




Reply With Quote
  #5  
Old   
Peter McMurray
 
Posts: n/a

Default Re: help in query! - 03-23-2006 , 07:35 PM



Hi
You call this mess an improvement? I am aware of the basis but since he is
new and needs a result my question still stands.
Peter McMurray
"Dave Goldfinch" <daveg50_8 (AT) NotCoolMail (DOT) invalid> wrote

Quote:
Because he has moved on from green screen and is developing in VB !

On Thu, 23 Mar 2006 01:45:01 GMT, "Peter McMurray"
excalibur21 (AT) bigpond (DOT) com> wrote:

Hi
I am at a loss to understand why you would not use Pick Basic and
AQL/English/Recall depending on which MV platform you are running.
Certainly something like
SSELECT TESTABLE BY DTPANEL WITH OEM = "1" "2" "3" "4" AND WITH MODEL ="1"
"2" "3" "4" AND WITH YEAR "2006"
seems a heck of a lot easier than all that SQL
Regards
Peter McMurray
"kanthi" <kanthir (AT) gmail (DOT) com> wrote in message
news:1143040443.100302.83220 (AT) u72g2000cwu (DOT) googlegroups.com...
hi,

i was trying to compare an attribute (DTPanel ) of Testtable for 4
vehicles of a particular OEM,Vehicle model and model year.......


i just started off with this code...am not sure how to frame the
query....could anyone help me on th same.....am a beginner


Option Compare Database


On Error GoTo ProcError


Dim strValueList$
Dim rs As DAO.Recordset
Dim strSQL As String, strTemp As String
Dim i As Integer
Dim count As Integer


i = 0


If chkIncludeDTPanel.Value = -1 Then


strSQL = "SELECT DTPanel FROM TestTable INNER JOIN VehicleTable" & _
" ON TestTable.DoorTrimPanelID =
VehicleTable.DoorTrimPanelID" & _
" WHERE VehicleTable.OEM = """ & Me.cboOEM.Column(1) &
"""" & _
" AND VehicleTable.VehicleModel = """ &
Me.CboVehicleModel.Column(1) & """" & _
" AND VehicleTable.ModelYear = " &
Me.cboModelYear.Column(1) & """" & _
" AND VehicleTable.OEM = """ & Me.CboOEM2.Column(1) &
"""" & _
" AND VehicleTable.VehicleModel = """ &
Me.CboVehicleModel2.Column(1) & """" & _
" AND VehicleTable.ModelYear = " &
Me.CboModelYear2.Column(1) & """" & _
" AND VehicleTable.OEM = """ & Me.CboOEM3.Column(1) &
"""" & _
" AND VehicleTable.VehicleModel = """ &
Me.CboVehicleModel3.Column(1) & """" & _
" AND VehicleTable.ModelYear = " &
Me.CboModelYear3.Column(1) & """" & _
" AND VehicleTable.OEM = """ & Me.CboOEM4.Column(1) &
"""" & _
" AND VehicleTable.VehicleModel = """ &
Me.CboVehicleModel4.Column(1) & """" & _
" AND VehicleTable.ModelYear = " &
Me.CboModelYear4.Column(1)


Set rs = CurrentDb.OpenRecordset(strSQL)


If Not rs.EOF Then
rs.MoveFirst
Do Until rs.EOF
i = 0
count = rs.Fields.count - 1
For i = 0 To count
strTemp = strTemp & rs.Fields(i).Name & ": " &
rs.Fields(i) & " "
Next i
rs.MoveNext
Loop
Else
MsgBox "No Records"
End If
End If


txtResults.Value = strTemp


ExitProc:
' Cleanup
On Error Resume Next
rs.Close: Set rs = Nothing
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure cmdPerformSearch_Click..."
Resume ExitProc
End Sub






Reply With Quote
  #6  
Old   
Ross Ferris
 
Posts: n/a

Default Re: help in query! - 03-23-2006 , 09:06 PM



The assumption being made here is that the OP was made to the correct
group --> BIG possibility this guy isn't using mv database


Reply With Quote
  #7  
Old   
Geoff Goodchild
 
Posts: n/a

Default Re: help in query! - 03-23-2006 , 10:21 PM




Ross Ferris wrote:
Quote:
The assumption being made here is that the OP was made to the correct
group --> BIG possibility this guy isn't using mv database
Reasonable guess as he also posted the query to the ms access group &
has received replies there. From looking at his other posts, he's not
that keen on the RTFM approach to programming.



Reply With Quote
  #8  
Old   
Ross Ferris
 
Posts: n/a

Default Re: help in query! - 03-23-2006 , 11:07 PM



Are you SURE he isn't an MV programmer ?


Reply With Quote
  #9  
Old   
Excalibur
 
Posts: n/a

Default Re: help in query! - 03-23-2006 , 11:10 PM



Hi Ross
That did cross my mind but then I thought the guy called a field an
attribute and anyway nobody could be that dumb could they.?
Peter McMurray
"Ross Ferris" <rossf (AT) stamina (DOT) com.au> wrote

Quote:
The assumption being made here is that the OP was made to the correct
group --> BIG possibility this guy isn't using mv database




Reply With Quote
  #10  
Old   
kanthi
 
Posts: n/a

Default Re: help in query! - 03-25-2006 , 06:49 PM



i solved my problem...


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.