13-09-15, 12:49
|
Όνομα: Γιώργος Έκδοση λογισμικού Office: Ms-Office 2007 Γλώσσα λογισμικού Office: Ελληνική | | Εγγραφή: 06-02-2010
Μηνύματα: 196
| |
error
Καλημέρα σε όλους
Στην παρακάτω Function μου εμφανίζει (Μη έγκυρη δήλωση SQL) όποια βοήθεια δεκτή γιατί έχω κόλληση.
[CODE'' -- Επιστρέφει τα χιλιοστά του διαμερίσματος που επιλέγεται αναλόγως της σχετικής δαπάνης
Function Calculate_exp_part(app_id As Integer, exp_type As Integer) As Double
Dim rs As New ADODB.Recordset
Dim cn As ADODB.Connection
Dim cm_mm As String, el_mm As String
Dim fx_mm As String, sp_mm As String, h_mm As String
Dim con_e As String
Dim node As Variant
Dim diam, i As Integer
diam = DLookup("arithmoos_diam", "tbl_heating_system")
node = DLookup("dapani_anel", "tbl_heating_system")
Set cn = CurrentProject.Connection
cm_mm = "SELECT tbl_appartments.common_mm FROM tbl_appartments where id=CInt('" & app_id & "');"
If node = "Εξ' ίσου" Then
el_mm = 1 / diam
Else
el_mm = "SELECT tbl_appartments.elevator_mm FROM tbl_appartments where id=CInt('" & app_id & "');"
End If
h_mm = "SELECT tbl_appartments.e FROM tbl_appartments where id=CInt('" & app_id & "');"
fx_mm = "SELECT tbl_appartments.fixed_mm FROM tbl_appartments where id=CInt('" & app_id & "');"
sp_mm = "SELECT tbl_appartments.special_mm FROM tbl_appartments where id=CInt('" & app_id & "');"
con_e = "SELECT tbl_appartments.con_e FROM tbl_appartments where id=CInt('" & app_id & "');"
If exp_type = 1 Then
rs.Open cm_mm, cn, adOpenKeyset, adLockOptimistic
ElseIf exp_type = 2 Then rs.Open el_mm, cn, adOpenKeyset, adLockOptimistic
ElseIf exp_type = 3 Then
rs.Open h_mm, cn, adOpenKeyset, adLockOptimistic
ElseIf exp_type = 4 Then
rs.Open fx_mm, cn, adOpenKeyset, adLockOptimistic
ElseIf exp_type = 5 Then
rs.Open sp_mm, cn, adOpenKeyset, adLockOptimistic
ElseIf exp_type = 6 Then
rs.Open con_e, cn, adOpenKeyset, adLockOptimistic
ElseIf exp_type = 7 Then
rs.Open fx_mm, cn, adOpenKeyset, adLockOptimistic
End If
If rs.RecordCount = 0 Then
Calculate_exp_part = 0
Else
Calculate_exp_part = Round(Nz(rs.Fields(0)), 4)
End If
End Function][/CODE]
Τελευταία επεξεργασία από το χρήστη anestaki : 13-09-15 στις 22:29.
|