
June 16th, 2000, 02:59 AM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,575
  
Time spent in forums: < 1 sec
Reputation Power: 22
|
|
|
access sql form to asp
<i><b>Originally posted by : Colin (colinduetta@graduates.iti.com)</b></i><br />Giday all, my first ever forum question. I have the following SQL form in access working well, but I need to convert to an asp, I'm using a DSNless connection, no prob. The question is do I/can I return my data, and what do I change to accomplish this feat?<br />Cheers, Report---<br /><br /><br />Option Compare Database<br />Option Explicit<br /><br /><br /><br />Private Sub cboCuisine_AfterUpdate()<br />lstresult = Null<br />End Sub<br /><br />Private Sub cmdSearch_Click()<br />Dim sql As String<br />Dim rs As Recordset<br /><br />If IsNull(cboCuisine) Then<br />MsgBox "Please enter a cuisine type.", vbOKCancel, "Cusuine"<br />cboCuisine.SetFocus<br />Exit Sub<br />Else<br />sql = "Select restaurant.name from cuisine inner join (restaurant inner join rest_cuisine on restaurant.[restaurant id]=rest_cuisine.[restaurant id]) on cuisine.[flag id]=rest_cuisine.[flag id] where ((cuisine.[flag style])= '" & Me![cboCuisine] & "') "<br /><br />If Not IsNull(cboatmosphere) Then<br />sql = sql & "and (restaurant.atmosphere)= '" & Me![cboatmosphere] & "' "<br />End If<br /><br />If LCBO = True Then<br />sql = sql & "and (restaurant.Licensed) = yes "<br />End If<br /><br />If optpatio = True Then<br />sql = sql & "and (restaurant.Patio) = yes "<br />End If<br /><br />If Not IsNull(cboPriceRange) Then<br />If cboPriceRange = "<40" Then<br />sql = sql & " and (restaurant.price <= 40)"<br />ElseIf cboPriceRange = "40-60" Then<br />sql = sql & " and (restaurant.price >40 and restaurant.price <= 60)"<br />ElseIf cboPriceRange = "60-80" Then<br />sql = sql & " and (restaurant.price >60 and restaurant.price <= 80)"<br />ElseIf cboPriceRange = "80-100" Then<br />sql = sql & " and (restaurant.price >80 and restaurant.price <= 100)"<br />ElseIf cboPriceRange = ">100" Then<br />sql = sql & " and (restaurant.price >100)"<br />End If<br />End If<br /><br />End If<br />sql = sql & ";"<br />Me![lstresult].RowSource = sql<br />If Me![lstresult].ListCount < 1 Then<br />MsgBox "Your search criteria returned 0 results... slapnuts", vbOKOnly, "Search"<br />Exit Sub<br />End If<br /><br />End Sub<br /><br /><br />
|