在运行时关闭操作消息时出现问题 - 追加查询无效 [英] Problem turning off action messages in runtime - append query not working

查看:55
本文介绍了在运行时关闭操作消息时出现问题 - 追加查询无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


首先,我想说谢谢你们在这里收到的所有帮助

。我一直在教自己Access大约4年

现在我一直都能在这里找到解决方案 - 直到现在。

这个让我抓狂。


我第一次尝试创建运行时应用程序。我使用Access 2003 Developer Extensions获得
。最初我开发了

数据库而没有计划创建一个运行时应用程序,但事情已经进展了,并且我希望将它分发给那些没有MS的人

访问。


我的问题是在没有收到确认

消息的情况下尝试运行追加查询。


我有一个包含子表单的主表单。在子窗体上是一个按钮,

将子窗体中的记录附加到标题和详细信息表中(如果

记录不存在)并打开另一个窗体以显示记录。

附加我正在使用两个查询的记录。这对我来说一直很好用,直到我在没有

访问权限的PC上试用运行时版本。


我研究过并且发现了不同的东西要尝试,所有这些都要求

不附加记录或给出参数错误。


按钮后面的完整代码是:


Private Sub CmdOpenDetails_Click()

On Error GoTo Err_CmdOpenDetails_Click


''验证比赛日期,赛道输入和比赛名称。


如果IsNull(Me.Track)那么

MsgBox请输入一首曲目。,vbCritical,否跟踪输入。

Me.Track.SetFocus

GoTo完成

否则


如果IsNull(Me.RaceDate)然后

MsgBox请输入比赛日期。,vbCritical,没有比赛日期

输入。

Me.RaceDate.SetFocus

GoTo完成

否则


如果是IsNull(Me.RaceName)那么

MsgBox"请输入种族名称。",vbCritical,没有种族名称

输入。

Me.RaceName.SetFocus

GoTo完成

结束如果

结束如果

结束如果

DoCmd。 RunCommand acCmdSaveRecord


Dim stDocName As String

Dim stLinkCriteria as String


On Error GoTo Err_CmdOpenDetails_Click


DoCmd.OpenQuery(" qryappendtblraceheader")

DoCmd.OpenQuery(" qryappendracedetail")

stDocName =" subfrmracedetails"


stLinkCriteria ="([TrackName] =" &安培; "" &安培;我![追踪]& "'')和

([RaceName] ="""& Me![RaceName]&""")AND [RaceDate] =" &安培; "#" &

我![RaceDate]& "#"


DoCmd.OpenForm stDocName ,,, stLinkCriteria


Exit_CmdOpenDetails_Click:

退出Sub


Err_CmdOpenDetails_Click:

MsgBox Err.Description

恢复Exit_CmdOpenDetails_Click


完成:


End Sub


我试图关闭动作确认:


执行方法 - 这导致需要3个参数错误

Setoption确认操作查询,错误 - 这将转到下一个表格

但不附加记录

Docmd.setwarnings False - 与setoption相同的结果

Application.SetOption确认操作查询,0加载


我的最新的尝试是创建一个关闭消息的宏,然后

重新打开它们。这也转移到了下一个表格,但没有

追加记录。


我真的不明白我做错了什么我已经用完了

的东西要尝试。


我真的很感激任何帮助,如果我没有

提供了足够的信息,请告诉我。


谢谢,


Lee

Hello All,

First of all I would like to say thank you for all of the help I have
received here. I have been teaching myself Access for about 4 years
now and I''ve always been able to find a solution here - until now.
This one is driving me crazy.

I am making my first attempt at creating a runtime application. I am
using Access 2003 Developer Extensions. Initially I developed the
database without planning on creating a runtime app but things have
progressed and I wanted to distribute it to those who don''t have MS
Access.

My problem is trying to run an append query without getting the confirm
messages.

I have a main form with a subform. On the subform is a button that
appends records from the subform into a header and detail table (if the
record does not exist) and opens another form to display the records.
Too append the records I am using two queries. This has always worked
for me perfectly well until I tried the runtime version on a PC without
Access.

I researched and found different things to try and all of them either
do not append the records or give a parameter error.

The full code behind the button is:

Private Sub CmdOpenDetails_Click()
On Error GoTo Err_CmdOpenDetails_Click

''Verify that Race Date, Race Track and Race Name are entered.

If IsNull(Me.Track) Then
MsgBox "Please enter a track.", vbCritical, "No Track entered."
Me.Track.SetFocus
GoTo Done
Else

If IsNull(Me.RaceDate) Then
MsgBox "Please enter a Race Date.", vbCritical, "No Race Date
entered."
Me.RaceDate.SetFocus
GoTo Done
Else

If IsNull(Me.RaceName) Then
MsgBox "Please enter a Race Name.", vbCritical, "No Race Name
entered."
Me.RaceName.SetFocus
GoTo Done
End If
End If
End If
DoCmd.RunCommand acCmdSaveRecord

Dim stDocName As String
Dim stLinkCriteria As String

On Error GoTo Err_CmdOpenDetails_Click

DoCmd.OpenQuery ("qryappendtblraceheader")
DoCmd.OpenQuery ("qryappendracedetail")

stDocName = "subfrmracedetails"

stLinkCriteria = "([TrackName]=" & "''" & Me![Track] & "'') AND
([RaceName]= """ & Me![RaceName] & """) AND [RaceDate]=" & "#" &
Me![RaceDate] & "#"

DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_CmdOpenDetails_Click:
Exit Sub

Err_CmdOpenDetails_Click:
MsgBox Err.Description
Resume Exit_CmdOpenDetails_Click

Done:

End Sub

I have attempted to turn off the action confirms with:

the execute method - this caused a "need 3 parameters error"
Setoption "Confirm Action Queries", False - this goes to the next form
but without appending the records
Docmd.setwarnings False - same result as setoption
Application.SetOption "Confirm Action Queries", 0 on load

My latest try was creating a macro turning off the messages and then
turning them back on. That also moved to the next form but did not
append the records.

I really don''t understand what I''m doing wrong and I''ve run out of
things to try.

I would really appreciate any help at all with this and if I haven''t
provided enough information please let me know.

Thank you,

Lee

推荐答案

Lee写道:
Lee wrote:
执行方法 - 这导致了需要3个参数错误
the execute method - this caused a "need 3 parameters error"




您是否在execute方法中尝试了dbFailOnError选项?

Access.CurrentDb.Execute" QryName",dbfailonError


-

Tim http://www.ucs.mun.ca/~tmarshal/

^ o<

/#)" Burp-beep,burp-beep ,burp-beep?" - Quaker Jake

/ ^^Whatcha doin? - 同上TIM-MAY !! - 我



Did you try the dbFailOnError option in the execute method?

Access.CurrentDb.Execute "QryName", dbfailonError

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me


感谢您的回复。


我不记得所以我只是再试一次,我''我仍然得到

错误参数太少了。预计3那就是使用完整的

访问程序。


谢谢,


Lee

Tim Marshall写道:
Thanks for the reply.

I couldn''t remember so I just tried it again and I''m still getting the
error "Too few parameters. Expected 3" And that is using the full
Access program.

Thanks,

Lee
Tim Marshall wrote:
Lee写道:
Lee wrote:
执行方法 - 这导致了需要3个参数错误
the execute method - this caused a "need 3 parameters error"



你是否在execute方法中尝试了dbFailOnError选项?

Access.CurrentDb.Execute" QryName",dbfailonError

-
Tim http://www.ucs.mun.ca/~tmarshal/
^ o<
/#)Burp-beep,burp-beep,burp-beep? - Quaker Jake
/ ^^Whatcha doin? - 同上TIM-MAY !! - 我



Did you try the dbFailOnError option in the execute method?

Access.CurrentDb.Execute "QryName", dbfailonError

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me






Lee写道:
Lee wrote:
感谢您的回复。
<我不记得所以我只是再试一次,我仍然得到
错误参数太少了。预计3这是使用完整的访问程序。
Thanks for the reply.

I couldn''t remember so I just tried it again and I''m still getting the
error "Too few parameters. Expected 3" And that is using the full
Access program.




我通常动态构建我的SQL(在VBA中)而不是使用存储的

querydefs。我记得有时会出现使用存储查询的问题

和execute方法。你可以发布查询的SQL,那是'

造成这种情况吗?当然,除非你弄清楚或有人想出更好的解决方案。 8)


-

Tim http://www.ucs.mun.ca/~tmarshal/

^ o<

/#)"打嗝,打嗝,打嗝? - Quaker Jake

/ ^^Whatcha doin? - 同上TIM-MAY !! - 我



I usually construct my SQL dynamically (in VBA) rather than used stored
querydefs. I do recall there were sometimes issues using stored queries
and the execute method. Can you post the SQL of the query(ies) that''s
causing this? Unless you figure out or someone comes up with a better
solution, of course. 8)

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me


这篇关于在运行时关闭操作消息时出现问题 - 追加查询无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆