L
Lorenzo
Hello,
I am struggling with this DSUM function in the following case:
I am trying to get the total amount for the [intImporto] in the reservation
table and display it in a text box using some parameters. In my form I have
a cboBox to select the apartment on which I want to base my query and two
text boxes to select the timespan I want to diaplay the sales for. All
works as expected as far as displaying the total for a certain apartment but
I get errors when I add the date parameters, this is what I have:
Private Sub cmdVisualizza_Click()
On Error GoTo Err_cmdVisualizza_Click
Dim strSQL As String
Dim dteInizio, dteFine As Date
dteInizio = Me.dteInizio
dteFine = Me.dteFine
strSQL = "[IDImmobile]= " & Me.cboImmobile & " AND [dteArrivo]
Between " & dteInizio & " and " & dteFine
Me.txtRisultato.Locked = False
Me.txtRisultato.Enabled = True
Me.txtRisultato.SetFocus
Me.txtRisultato.Text = DSum("[intImporto]", "tblPrenotazioni", strSQL)
Me.cmdVisualizza.SetFocus
Me.txtRisultato.Locked = True
Me.txtRisultato.Enabled = False
Exit_cmdVisualizza_Click:
Exit Sub
Err_cmdVisualizza_Click:
msgBox Err.Description
Resume Exit_cmdVisualizza_Click
End Sub
I get an operator missing in my msgBox warning ERR 3075 what am I doing
wrong the query seems correct...
Lorenzo
I am struggling with this DSUM function in the following case:
I am trying to get the total amount for the [intImporto] in the reservation
table and display it in a text box using some parameters. In my form I have
a cboBox to select the apartment on which I want to base my query and two
text boxes to select the timespan I want to diaplay the sales for. All
works as expected as far as displaying the total for a certain apartment but
I get errors when I add the date parameters, this is what I have:
Private Sub cmdVisualizza_Click()
On Error GoTo Err_cmdVisualizza_Click
Dim strSQL As String
Dim dteInizio, dteFine As Date
dteInizio = Me.dteInizio
dteFine = Me.dteFine
strSQL = "[IDImmobile]= " & Me.cboImmobile & " AND [dteArrivo]
Between " & dteInizio & " and " & dteFine
Me.txtRisultato.Locked = False
Me.txtRisultato.Enabled = True
Me.txtRisultato.SetFocus
Me.txtRisultato.Text = DSum("[intImporto]", "tblPrenotazioni", strSQL)
Me.cmdVisualizza.SetFocus
Me.txtRisultato.Locked = True
Me.txtRisultato.Enabled = False
Exit_cmdVisualizza_Click:
Exit Sub
Err_cmdVisualizza_Click:
msgBox Err.Description
Resume Exit_cmdVisualizza_Click
End Sub
I get an operator missing in my msgBox warning ERR 3075 what am I doing
wrong the query seems correct...
Lorenzo