Update Query Confirmation

B

Brandon Mackie

I am incredibly new to access and trying to learn as I go. I have set up a
few queries one of which is executed by a docmd.runsql in visual basic.
Because it is an update query it asks for confirmation every time it wants
to update the table. Is there any way to get around this?
 
K

Ken Snell

Two ways:

(1) Precede your DoCmd.RunSQL command with this code step to turn them off:
DoCmd.SetWarnings False

Then succeed your command with this code step to turn them back on:
DoCmd.SetWarnings True


(2) Use the CurrentDb.Execute "SQLStatement" code step to run the query. If
you want to have it "fail on error", then use this line:
CurrentDb.Execute "SQLStatement", dbFailOnError
 
B

Brandon M

Alright. The second way kept on giving me an error of Too Few Parameters or
something like that. I am assuming that it is because the SQL statement is
not formatted as required somehow... Anyways I saved the query and now am
not sure how to refer to it in the execute statement. I am trying the second
way because I need error checking of some kind and if I am not mistaken the
DoCmd.RunSQL does not allow for that.
 
B

Brandon M

I tried that. For some reason it gives me the error "Too Few Parameters.
Expected: 1". Here are the details:

CurrentDb.Execute "DailyBranchStats"

DailyBranchStats is the name of the query. Am I doing something wrong here?

Thank-you so much for all of your help!
 
K

Ken Snell

The error message that you're getting indicates that your query is seeking a
parameter (either asking the user for a value, or getting a value from a
form).

To call such a query programmatically, you must evaluate the parameters
first, and then you can execute the query. In this case, a different
approach will be needed, using the DAO QueryDefs object instead of the
options that I'd given to you earlier.

---Start of Code Snippet---

Dim dbs As DAO.Database
Dim prm As DAO.Parameter
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim strSQL As String
Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("DailyBranchStats")
For Each prm In qdf.Parameters
prm.Value = Eval(prm.Name)
Next prm
qdf.Execute dbFailOnError
qdf.Close
Set qdf = Nothing
dbs.Close
Set dbs = Nothing

---End Code Snippet---
 
B

Brandon M

Sorry to be a bother yet again but it gives me a big evil user-defined type
not defined on the Dim dbs As DAO.Database line. I've searched all over...
can not find anywhere to include libraries, etc.
 
D

Douglas J. Steele

With any code module open, select Tools | References from the menu bar,
scroll through the list of available references until you find the one for
Microsoft DAO 3.6 Object Library, and select it.
 
K

Ken Snell

You likely are running ACCESS 2000 or 2002, right? Those two versions do not
have the DAO library set as a reference by default. Instead, they have the
ADODB library set as a default.

Open the Visual Basic Editor, select Tools | References, and find the Data
Access Object Library 3.x and select it as a reference.

That should eliminate that error.
 
B

Brandon M

I have used the code snippet below creating a function which will be used to
run any query that is passed to it and returning the number of records
affected. Now I know the query is okay as it runs on it's own but when
called through the snippet you provided it gives me a runtime error 3464
(data type mismatch) on the qdf.execute line.

So here is the saved query:
INSERT INTO tblBranchStats ( DateRec, CallTime_0715, CallTime_1523,
CallTime_2307 )
SELECT CDate(forms.frmUpdate.txtSaveDate) AS DateRec,
(DailyBranchStats0715.TotalTalkTime/DailyBranchStats0715.TotalOnTime) AS
CallTime0715,
(DailyBranchStats1523.TotalTalkTime/DailyBranchStats1523.TotalOnTime) AS
CallTime1523,
(DailyBranchStats2307.TotalTalkTime/DailyBranchStats2307.TotalOnTime) AS
CallTime2307
FROM DailyBranchStats0715, DailyBranchStats1523, DailyBranchStats2307;

The watch says that the only parameter is forms.frmUpdate.txtSaveDate and
after the eval line the value is stored as a date string (11/12/03). Am I
missing something?
 
B

Brandon M

Result: Nothing. Access automatically updated
[Forms]![frmUpdate]![txtSaveDate] to Forms!frmUpdate!txtSaveDate

This is driving me crazy!

*************Here is the code:
Private Sub cmdUpdate_Click()
Dim LoopDate As Date
Dim BranchRec As Long
Dim EmployRec As Long

With Forms.frmUpdate
For LoopDate = .txtStartDate To .txtEndDate
.txtSaveDate = LoopDate
BranchRec = RunQuery("DailyBranchStats")
Next LoopDate
End With

End Sub

*************Here is the function:
Function RunQuery(ByVal RunStr As String) As Long
Dim dbs As DAO.Database
Dim prm As DAO.Parameter
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim strSQL As String

Set dbs = CurrentDb
Set qdf = dbs.QueryDefs(RunStr)
For Each prm In qdf.Parameters
prm.Value = Eval(prm.Name)
Next prm
qdf.Execute dbFailOnError
RunQuery = qdf.RecordsAffected
qdf.Close
Set qdf = Nothing
dbs.Close
Set dbs = Nothing

End Function

*************DailyBranchStats
INSERT INTO tblBranchStats ( DateRec, CallTime_0715, CallTime_1523,
CallTime_2307 )
SELECT CDate(Forms!frmUpdate!txtSaveDate) AS DateRec,
(DailyBranchStats0715.TotalTalkTime/DailyBranchStats0715.TotalOnTime) AS
CallTime0715,
(DailyBranchStats1523.TotalTalkTime/DailyBranchStats1523.TotalOnTime) AS
CallTime1523,
(DailyBranchStats2307.TotalTalkTime/DailyBranchStats2307.TotalOnTime) AS
CallTime2307
FROM DailyBranchStats0715, DailyBranchStats1523, DailyBranchStats2307;

*************Here are the subqueries.. maybe that will help!
SELECT Sum(mOpInterval.SecTalkTime+mOpInterval.CheckTalkTime) AS
TotalTalkTime, Sum(mOpInterval.OnTime) AS TotalOnTime
FROM mOpInterval IN 'C:\Shared\In Progress\MDRetrieve\MDR.mdb'
WHERE (((mOpInterval.Timestamp)>=((CDate(Forms!frmUpdate!txtSaveDate & "
7:00a")-1)*1440) And
(mOpInterval.Timestamp)<=((CDate(Forms!frmUpdate!txtSaveDate & "
2:59p")+1)*1440)));

SELECT SUM(mOpInterval.SecTalkTime+mOpInterval.CheckTalkTime) AS
TotalTalkTime, SUM(mOpInterval.OnTime) AS TotalOnTime
FROM mOpInterval IN 'C:\Shared\In Progress\MDRetrieve\MDR.mdb'
WHERE (((mOpInterval.Timestamp)>=((CDate(Forms!frmUpdate!txtSaveDate & "
3:00p")-1)*1440) And
(mOpInterval.Timestamp)<=((CDate(Forms!frmUpdate!txtSaveDate & "
10:59p")+1)*1440)));

SELECT SUM(mOpInterval.SecTalkTime+mOpInterval.CheckTalkTime) AS
TotalTalkTime, SUM(mOpInterval.OnTime) AS TotalOnTime
FROM mOpInterval IN 'C:\Shared\In Progress\MDRetrieve\MDR.mdb'
WHERE (((mOpInterval.Timestamp)>=((CDate(Forms!frmUpdate!txtSaveDate & "
11:00p")-1)*1440) And
(mOpInterval.Timestamp)<=((CDate((Forms!frmUpdate!txtSaveDate+1) & "
6:59a")+1)*1440)));



Ken Snell said:
Change

forms.frmUpdate.txtSaveDate

to

[Forms]![frmUpdate]![txtSaveDate]


--
Ken Snell
<MS ACCESS MVP>

Brandon M said:
I have used the code snippet below creating a function which will be
used
to
run any query that is passed to it and returning the number of records
affected. Now I know the query is okay as it runs on it's own but when
called through the snippet you provided it gives me a runtime error 3464
(data type mismatch) on the qdf.execute line.

So here is the saved query:
INSERT INTO tblBranchStats ( DateRec, CallTime_0715, CallTime_1523,
CallTime_2307 )
SELECT CDate(forms.frmUpdate.txtSaveDate) AS DateRec,
(DailyBranchStats0715.TotalTalkTime/DailyBranchStats0715.TotalOnTime) AS
CallTime0715,
(DailyBranchStats1523.TotalTalkTime/DailyBranchStats1523.TotalOnTime) AS
CallTime1523,
(DailyBranchStats2307.TotalTalkTime/DailyBranchStats2307.TotalOnTime) AS
CallTime2307
FROM DailyBranchStats0715, DailyBranchStats1523, DailyBranchStats2307;

The watch says that the only parameter is forms.frmUpdate.txtSaveDate and
after the eval line the value is stored as a date string (11/12/03). Am I
missing something?

seeking inside
the and
now trying
the
 
K

Ken Snell

Subqueries? This is the first that you've mentioned them...and you didn't
identify them by their names from the "main" query, though I suppose it's
not important at the moment because they appear to be copies of each other
except for the time ranges.

Based on the previous exchange, you do now have a reference to the DAO
library set, correct?

Assuming this to be true, then the "data type mismatch" error likely is
something in the query or subqueries. This can happen if a Null value is in
a field and you're trying to use a function on it that doesn't accept Null
arguments. On close inspection, I think this may be the problem in your
third subquery (last two lines):

You have this expression:





Brandon M said:
Result: Nothing. Access automatically updated
[Forms]![frmUpdate]![txtSaveDate] to Forms!frmUpdate!txtSaveDate

This is driving me crazy!

*************Here is the code:
Private Sub cmdUpdate_Click()
Dim LoopDate As Date
Dim BranchRec As Long
Dim EmployRec As Long

With Forms.frmUpdate
For LoopDate = .txtStartDate To .txtEndDate
.txtSaveDate = LoopDate
BranchRec = RunQuery("DailyBranchStats")
Next LoopDate
End With

End Sub

*************Here is the function:
Function RunQuery(ByVal RunStr As String) As Long
Dim dbs As DAO.Database
Dim prm As DAO.Parameter
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim strSQL As String

Set dbs = CurrentDb
Set qdf = dbs.QueryDefs(RunStr)
For Each prm In qdf.Parameters
prm.Value = Eval(prm.Name)
Next prm
qdf.Execute dbFailOnError
RunQuery = qdf.RecordsAffected
qdf.Close
Set qdf = Nothing
dbs.Close
Set dbs = Nothing

End Function

*************DailyBranchStats
INSERT INTO tblBranchStats ( DateRec, CallTime_0715, CallTime_1523,
CallTime_2307 )
SELECT CDate(Forms!frmUpdate!txtSaveDate) AS DateRec,
(DailyBranchStats0715.TotalTalkTime/DailyBranchStats0715.TotalOnTime) AS
CallTime0715,
(DailyBranchStats1523.TotalTalkTime/DailyBranchStats1523.TotalOnTime) AS
CallTime1523,
(DailyBranchStats2307.TotalTalkTime/DailyBranchStats2307.TotalOnTime) AS
CallTime2307
FROM DailyBranchStats0715, DailyBranchStats1523, DailyBranchStats2307;

*************Here are the subqueries.. maybe that will help!
SELECT Sum(mOpInterval.SecTalkTime+mOpInterval.CheckTalkTime) AS
TotalTalkTime, Sum(mOpInterval.OnTime) AS TotalOnTime
FROM mOpInterval IN 'C:\Shared\In Progress\MDRetrieve\MDR.mdb'
WHERE (((mOpInterval.Timestamp)>=((CDate(Forms!frmUpdate!txtSaveDate & "
7:00a")-1)*1440) And
(mOpInterval.Timestamp)<=((CDate(Forms!frmUpdate!txtSaveDate & "
2:59p")+1)*1440)));

SELECT SUM(mOpInterval.SecTalkTime+mOpInterval.CheckTalkTime) AS
TotalTalkTime, SUM(mOpInterval.OnTime) AS TotalOnTime
FROM mOpInterval IN 'C:\Shared\In Progress\MDRetrieve\MDR.mdb'
WHERE (((mOpInterval.Timestamp)>=((CDate(Forms!frmUpdate!txtSaveDate & "
3:00p")-1)*1440) And
(mOpInterval.Timestamp)<=((CDate(Forms!frmUpdate!txtSaveDate & "
10:59p")+1)*1440)));

SELECT SUM(mOpInterval.SecTalkTime+mOpInterval.CheckTalkTime) AS
TotalTalkTime, SUM(mOpInterval.OnTime) AS TotalOnTime
FROM mOpInterval IN 'C:\Shared\In Progress\MDRetrieve\MDR.mdb'
WHERE (((mOpInterval.Timestamp)>=((CDate(Forms!frmUpdate!txtSaveDate & "
11:00p")-1)*1440) And
(mOpInterval.Timestamp)<=((CDate((Forms!frmUpdate!txtSaveDate+1) & "
6:59a")+1)*1440)));



Ken Snell said:
Change

forms.frmUpdate.txtSaveDate

to

[Forms]![frmUpdate]![txtSaveDate]


--
Ken Snell
<MS ACCESS MVP>

Brandon M said:
I have used the code snippet below creating a function which will be
used
to
run any query that is passed to it and returning the number of records
affected. Now I know the query is okay as it runs on it's own but when
called through the snippet you provided it gives me a runtime error 3464
(data type mismatch) on the qdf.execute line.

So here is the saved query:
INSERT INTO tblBranchStats ( DateRec, CallTime_0715, CallTime_1523,
CallTime_2307 )
SELECT CDate(forms.frmUpdate.txtSaveDate) AS DateRec,
(DailyBranchStats0715.TotalTalkTime/DailyBranchStats0715.TotalOnTime) AS
CallTime0715,
(DailyBranchStats1523.TotalTalkTime/DailyBranchStats1523.TotalOnTime) AS
CallTime1523,
(DailyBranchStats2307.TotalTalkTime/DailyBranchStats2307.TotalOnTime) AS
CallTime2307
FROM DailyBranchStats0715, DailyBranchStats1523, DailyBranchStats2307;

The watch says that the only parameter is forms.frmUpdate.txtSaveDate and
after the eval line the value is stored as a date string (11/12/03).
Am
from
a run
the
 
K

Ken Snell

Sorry about that incomplete post....shortcut keys went awry....
--------------------
Subqueries? This is the first that you've mentioned them...and you didn't
identify them by their names from the "main" query, though I suppose it's
not important at the moment because they appear to be copies of each other
except for the time ranges.

Based on the previous exchange, you do now have a reference to the DAO
library set, correct?

Assuming this to be true, then the "data type mismatch" error likely is
something in the query or subqueries. This can happen if a Null value is in
a field and you're trying to use a function on it that doesn't accept Null
arguments. On close inspection, I think this may be the problem in your
third subquery (last two lines):

You have this expression:

CDate((Forms!frmUpdate!txtSaveDate+1) & "6:59a")

You cannot add 1 to a text string, which is what I believe your parameter is
becoming. Thus, perhaps you should change this expression to this:

CDate((Forms!frmUpdate!txtSaveDate) & "6:59a")+1

or just delete the "+1" entirely, as this is the only expression where you
use it with the Forms reference?

--
Ken Snell
<MS ACCESS MVP>


Brandon M said:
Result: Nothing. Access automatically updated
[Forms]![frmUpdate]![txtSaveDate] to Forms!frmUpdate!txtSaveDate

This is driving me crazy!

*************Here is the code:
Private Sub cmdUpdate_Click()
Dim LoopDate As Date
Dim BranchRec As Long
Dim EmployRec As Long

With Forms.frmUpdate
For LoopDate = .txtStartDate To .txtEndDate
.txtSaveDate = LoopDate
BranchRec = RunQuery("DailyBranchStats")
Next LoopDate
End With

End Sub

*************Here is the function:
Function RunQuery(ByVal RunStr As String) As Long
Dim dbs As DAO.Database
Dim prm As DAO.Parameter
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim strSQL As String

Set dbs = CurrentDb
Set qdf = dbs.QueryDefs(RunStr)
For Each prm In qdf.Parameters
prm.Value = Eval(prm.Name)
Next prm
qdf.Execute dbFailOnError
RunQuery = qdf.RecordsAffected
qdf.Close
Set qdf = Nothing
dbs.Close
Set dbs = Nothing

End Function

*************DailyBranchStats
INSERT INTO tblBranchStats ( DateRec, CallTime_0715, CallTime_1523,
CallTime_2307 )
SELECT CDate(Forms!frmUpdate!txtSaveDate) AS DateRec,
(DailyBranchStats0715.TotalTalkTime/DailyBranchStats0715.TotalOnTime) AS
CallTime0715,
(DailyBranchStats1523.TotalTalkTime/DailyBranchStats1523.TotalOnTime) AS
CallTime1523,
(DailyBranchStats2307.TotalTalkTime/DailyBranchStats2307.TotalOnTime) AS
CallTime2307
FROM DailyBranchStats0715, DailyBranchStats1523, DailyBranchStats2307;

*************Here are the subqueries.. maybe that will help!
SELECT Sum(mOpInterval.SecTalkTime+mOpInterval.CheckTalkTime) AS
TotalTalkTime, Sum(mOpInterval.OnTime) AS TotalOnTime
FROM mOpInterval IN 'C:\Shared\In Progress\MDRetrieve\MDR.mdb'
WHERE (((mOpInterval.Timestamp)>=((CDate(Forms!frmUpdate!txtSaveDate & "
7:00a")-1)*1440) And
(mOpInterval.Timestamp)<=((CDate(Forms!frmUpdate!txtSaveDate & "
2:59p")+1)*1440)));

SELECT SUM(mOpInterval.SecTalkTime+mOpInterval.CheckTalkTime) AS
TotalTalkTime, SUM(mOpInterval.OnTime) AS TotalOnTime
FROM mOpInterval IN 'C:\Shared\In Progress\MDRetrieve\MDR.mdb'
WHERE (((mOpInterval.Timestamp)>=((CDate(Forms!frmUpdate!txtSaveDate & "
3:00p")-1)*1440) And
(mOpInterval.Timestamp)<=((CDate(Forms!frmUpdate!txtSaveDate & "
10:59p")+1)*1440)));

SELECT SUM(mOpInterval.SecTalkTime+mOpInterval.CheckTalkTime) AS
TotalTalkTime, SUM(mOpInterval.OnTime) AS TotalOnTime
FROM mOpInterval IN 'C:\Shared\In Progress\MDRetrieve\MDR.mdb'
WHERE (((mOpInterval.Timestamp)>=((CDate(Forms!frmUpdate!txtSaveDate & "
11:00p")-1)*1440) And
(mOpInterval.Timestamp)<=((CDate((Forms!frmUpdate!txtSaveDate+1) & "
6:59a")+1)*1440)));



Ken Snell said:
Change

forms.frmUpdate.txtSaveDate

to

[Forms]![frmUpdate]![txtSaveDate]


--
Ken Snell
<MS ACCESS MVP>

Brandon M said:
I have used the code snippet below creating a function which will be
used
to
run any query that is passed to it and returning the number of records
affected. Now I know the query is okay as it runs on it's own but when
called through the snippet you provided it gives me a runtime error 3464
(data type mismatch) on the qdf.execute line.

So here is the saved query:
INSERT INTO tblBranchStats ( DateRec, CallTime_0715, CallTime_1523,
CallTime_2307 )
SELECT CDate(forms.frmUpdate.txtSaveDate) AS DateRec,
(DailyBranchStats0715.TotalTalkTime/DailyBranchStats0715.TotalOnTime) AS
CallTime0715,
(DailyBranchStats1523.TotalTalkTime/DailyBranchStats1523.TotalOnTime) AS
CallTime1523,
(DailyBranchStats2307.TotalTalkTime/DailyBranchStats2307.TotalOnTime) AS
CallTime2307
FROM DailyBranchStats0715, DailyBranchStats1523, DailyBranchStats2307;

The watch says that the only parameter is forms.frmUpdate.txtSaveDate and
after the eval line the value is stored as a date string (11/12/03).
Am
from
a run
the
 
B

Brandon M

That was it! Thank-you. I knew it would be a silly mistake.


Ken Snell said:
Sorry about that incomplete post....shortcut keys went awry....
--------------------
Subqueries? This is the first that you've mentioned them...and you didn't
identify them by their names from the "main" query, though I suppose it's
not important at the moment because they appear to be copies of each other
except for the time ranges.

Based on the previous exchange, you do now have a reference to the DAO
library set, correct?

Assuming this to be true, then the "data type mismatch" error likely is
something in the query or subqueries. This can happen if a Null value is in
a field and you're trying to use a function on it that doesn't accept Null
arguments. On close inspection, I think this may be the problem in your
third subquery (last two lines):

You have this expression:

CDate((Forms!frmUpdate!txtSaveDate+1) & "6:59a")

You cannot add 1 to a text string, which is what I believe your parameter is
becoming. Thus, perhaps you should change this expression to this:

CDate((Forms!frmUpdate!txtSaveDate) & "6:59a")+1

or just delete the "+1" entirely, as this is the only expression where you
use it with the Forms reference?

--
Ken Snell
<MS ACCESS MVP>


Brandon M said:
Result: Nothing. Access automatically updated
[Forms]![frmUpdate]![txtSaveDate] to Forms!frmUpdate!txtSaveDate

This is driving me crazy!

*************Here is the code:
Private Sub cmdUpdate_Click()
Dim LoopDate As Date
Dim BranchRec As Long
Dim EmployRec As Long

With Forms.frmUpdate
For LoopDate = .txtStartDate To .txtEndDate
.txtSaveDate = LoopDate
BranchRec = RunQuery("DailyBranchStats")
Next LoopDate
End With

End Sub

*************Here is the function:
Function RunQuery(ByVal RunStr As String) As Long
Dim dbs As DAO.Database
Dim prm As DAO.Parameter
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim strSQL As String

Set dbs = CurrentDb
Set qdf = dbs.QueryDefs(RunStr)
For Each prm In qdf.Parameters
prm.Value = Eval(prm.Name)
Next prm
qdf.Execute dbFailOnError
RunQuery = qdf.RecordsAffected
qdf.Close
Set qdf = Nothing
dbs.Close
Set dbs = Nothing

End Function

*************DailyBranchStats
INSERT INTO tblBranchStats ( DateRec, CallTime_0715, CallTime_1523,
CallTime_2307 )
SELECT CDate(Forms!frmUpdate!txtSaveDate) AS DateRec,
(DailyBranchStats0715.TotalTalkTime/DailyBranchStats0715.TotalOnTime) AS
CallTime0715,
(DailyBranchStats1523.TotalTalkTime/DailyBranchStats1523.TotalOnTime) AS
CallTime1523,
(DailyBranchStats2307.TotalTalkTime/DailyBranchStats2307.TotalOnTime) AS
CallTime2307
FROM DailyBranchStats0715, DailyBranchStats1523, DailyBranchStats2307;

*************Here are the subqueries.. maybe that will help!
SELECT Sum(mOpInterval.SecTalkTime+mOpInterval.CheckTalkTime) AS
TotalTalkTime, Sum(mOpInterval.OnTime) AS TotalOnTime
FROM mOpInterval IN 'C:\Shared\In Progress\MDRetrieve\MDR.mdb'
WHERE (((mOpInterval.Timestamp)>=((CDate(Forms!frmUpdate!txtSaveDate & "
7:00a")-1)*1440) And
(mOpInterval.Timestamp)<=((CDate(Forms!frmUpdate!txtSaveDate & "
2:59p")+1)*1440)));

SELECT SUM(mOpInterval.SecTalkTime+mOpInterval.CheckTalkTime) AS
TotalTalkTime, SUM(mOpInterval.OnTime) AS TotalOnTime
FROM mOpInterval IN 'C:\Shared\In Progress\MDRetrieve\MDR.mdb'
WHERE (((mOpInterval.Timestamp)>=((CDate(Forms!frmUpdate!txtSaveDate & "
3:00p")-1)*1440) And
(mOpInterval.Timestamp)<=((CDate(Forms!frmUpdate!txtSaveDate & "
10:59p")+1)*1440)));

SELECT SUM(mOpInterval.SecTalkTime+mOpInterval.CheckTalkTime) AS
TotalTalkTime, SUM(mOpInterval.OnTime) AS TotalOnTime
FROM mOpInterval IN 'C:\Shared\In Progress\MDRetrieve\MDR.mdb'
WHERE (((mOpInterval.Timestamp)>=((CDate(Forms!frmUpdate!txtSaveDate & "
11:00p")-1)*1440) And
(mOpInterval.Timestamp)<=((CDate((Forms!frmUpdate!txtSaveDate+1) & "
6:59a")+1)*1440)));



Ken Snell said:
Change

forms.frmUpdate.txtSaveDate

to

[Forms]![frmUpdate]![txtSaveDate]


--
Ken Snell
<MS ACCESS MVP>

I have used the code snippet below creating a function which will be used
to
run any query that is passed to it and returning the number of records
affected. Now I know the query is okay as it runs on it's own but when
called through the snippet you provided it gives me a runtime error 3464
(data type mismatch) on the qdf.execute line.

So here is the saved query:
INSERT INTO tblBranchStats ( DateRec, CallTime_0715, CallTime_1523,
CallTime_2307 )
SELECT CDate(forms.frmUpdate.txtSaveDate) AS DateRec,
(DailyBranchStats0715.TotalTalkTime/DailyBranchStats0715.TotalOnTime)
(DailyBranchStats1523.TotalTalkTime/DailyBranchStats1523.TotalOnTime)
(DailyBranchStats2307.TotalTalkTime/DailyBranchStats2307.TotalOnTime)
AS forms.frmUpdate.txtSaveDate
and Am from query
and
go.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top