Steve,
I don't know there seems something to be wrong in the string:
Private Sub Command25_Click()
Dim strSQL As String
strSQL = "DELETE * FROM RAWDATA WHERE True"
If IsNull(Me.cmd_splash_cpy) Then
' proceed
Else
strSQL = strSQL & "[COMP]=" & Me.cmd_splash_cpy
End If
If IsNull(Me.cmd_splash_yr) Then
' proceed
Else
strSQL = strSQL & " AND [YEAR]=" & Me.cmd_splash_yr
End If
If IsNull(Me.cmd_splash_per) Then
' proceed
Else
strSQL = strSQL & " AND [PER]=" & Me.cmd_splash_per
End If
If IsNull(Me.cmd_splash_typ) Then
' proceed
Else
strSQL = strSQL & " AND [DATA]=" & Me.cmd_splash_typ & "'" 'Text
End If
If IsNull(Me.cmd_splash_cur) Then
' proceed
Else
strSQL = strSQL & " AND [CUR]=" & Me.cmd_splash_cur & "'" 'Text
End If
If IsNull(Me.cmd_splash_acc) Then
' proceed
Else
strSQL = strSQL & " AND [ACC]=" & Me.cmd_splash_acc
End If
If IsNull(Me.cmd_splash_cc) Then
' proceed
Else
strSQL = strSQL & " AND [CC]=" & Me.cmd_splash_cc & "'" 'Text
End If
If IsNull(Me.cmd_splash_ord) Then
' proceed
Else
strSQL = strSQL & " AND [ORD]=" & Me.cmd_splash_ord & "'" 'Text
End If
CurrentDb.Execute strSQL, dbFailOnError
End Sub
Steve said:
Soeren,
Well, I would definitely recommend doing this by performing your data
manipulations in code. So, assuming the user is entering the criteria
in the comboboxes, and then click a button, or some other event, to make
it happen. So, to use the example of deleting records that meet the
criteria, the code on the applicable event might be something like
this...
Dim strSQL As String
strSQL = "DELETE * FROM YourTable WHERE True"
If IsNull(Me.1stCombobox) Then
' proceed
Else
strSQL = strSQL & " AND [NumericalField]=" & Me.1stCombobox
End If
If IsNull(Me.2ndCombobox) Then
' proceed
Else
strSQL = strSQL & " AND [TextField]='" & Me.2ndCombobox & "'"
End If
... etc for all 7 comboboxes
CurrentDb.Execute strSQL, dbFailOnError
--
Steve Schapel, Microsoft Access MVP
(e-mail address removed) wrote:
I try to manipulate a cube-like data structure which i keep in a
backend database. I want to enable the user to select the data he might
like to delete, duplicate, or to update by changing either one or up to
seven criterias (Company, Year, Period, Account, Cost Center, Datatype,
Order + Value.) For this reason i thought using combo-boxes in the
frontent might be suitable for choosing the criterias for the querry or
the vba procedure. What might be the coding for realization of the
scope (delete sections, duplicate sections by providing new criterias
in different combo boxes, and to update he value field by using another
text-box on the front-end).