将身份证号码传递给acGoTo(新手) [英] Passing an ID number to acGoTo (newbie)

查看:91
本文介绍了将身份证号码传递给acGoTo(新手)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我从来没有真正使用VBScript - 我是一个老式的HTML人 - 但我想我会去,因为我想做一些真正的事情在我的Access 2000数据库中SIMPLE。几天之后,这是一个寻求帮助的请求,我反复搜索互联网并进行实验,因为我敢于寻找可行的任何东西。


我有一个名为Communications的表格(我现在知道它应该是frm_Communications!)。其中有一个名为缩写的组合框。这是指行源:qry_Union_Abbreviations从名为Communications的表中获取缩写列表,以及ID号和全名,是的,应该是tbl_Communications!)。


查询有一个绑定列,字段ID是第一个,并且是索引和主键(形式为Unions,我想要调用)。


无论如何 - 简单任务我设置自己是在这个组合框旁边放一个小按钮,当点击它时,将引用组合框中的数据然后打开另一个表单并转到其值是在组合框中命名的记录。 />

这里是我用于On_Click事件过程的代码:


Private Sub Union_more_Click()

intGlobalVariable = [联名缩写]

DoCmd.OpenForm联盟

DoCmd.GoToRecord ,, acGoTo,intGlobalVariable

End Sub


intGlobalVariable在名为Module1的模块中定义为Integer。它还包含strGlobalVariable,定义为字符串。


点击后我得到错误号2498 - 你输入的表达式是其中一个参数的错误数据类型。 />

在调试中,我看到acGoTo值为4。 (似乎总是4,无论我从哪个记录开始),而intGlobalVariable是组合框中的文本字符串。


如果我使用strGlobalVariable,它没有任何区别。


我必须说我已经尝试了所有我能做到的在论坛中找到,经验让我对VBScript感兴趣,但我知道肯定不会自己解决这个问题。您提供的任何建议都有助于保持我的理智。


PS如果有任何帮助,以下代码打开正确的表格,并转到正确的记录:


Private Sub Union_more_Click()

DoCmd.OpenFormUnions

DoCmd.GoToRecord,acGoTo,7

End Sub


我想我只需要找到一种方法将ID号传递给acGoTo。但是我会让你成为那个判断。

Hi
I''ve never really worked with VBScript - I''m an old-fashioned HTML guy - but I thought I''d have a go because I wanted to do something REALLY SIMPLE in my Access 2000 database. This is a plea for help, days later, having trawled the Internet repeatedly and experimented as much as I dare looking for anything that will work.

I have a form called Communications (I now know it shoulda been frm_Communications!). In it there is a combo box called Abbreviation. This refers to the Row Source: qry_Union_Abbreviations to get a list of abbreviations, along with ID number and Full name, from a Table called Communications (yep, shoulda been tbl_Communications!).

The query concerned has one bound column, and the field ID is the first one, and is indexed and a primary key (in the form "Unions" which I''m wanting to call).

Anyway - the "simple task" I set myself was to put a little button beside this combo box which, when clicked on, would refer to the data in the Combo box and then open another form and go to the record whose value was that named in the Combo box.

Here''s the code I have used for my On_Click Event Procedure:

Private Sub Union_more_Click()
intGlobalVariable = [Union Abbreviation]
DoCmd.OpenForm "Unions"
DoCmd.GoToRecord , , acGoTo, intGlobalVariable
End Sub

intGlobalVariable is defined as an Integer in a module called Module1. which also contains strGlobalVariable, defined as a string.

On click I get error number 2498 - "an expression you entered is the wrong data type for one of the arguments".

In debugging I see the acGoTo value is "4" (seems to be always 4, no matter which record I start from) while the intGlobalVariable is the text string in the combo box.

If I use strGlobalVariable it makes no difference.

I have to say I''ve tried everything I''ve been able to find in forums, and the experience has got me interested in VBScript, but I know for sure ain''t gonna solve this one on my own. Any suggestions you can offer will help preserve my sanity.

PS If it''s any help the following code DOES open the right form, and go to the right record:

Private Sub Union_more_Click()
DoCmd.OpenForm "Unions"
DoCmd.GoToRecord , , acGoTo, 7
End Sub

I think I just need to find a way to pass an ID number to acGoTo. But I''ll let you be the judge of that.

推荐答案

你好

我想设置一个按钮将以另一种形式转到字符串值。你说太简单了吗?


我有一个名为Communications的表格。其中有一个名为缩写的组合框。这是指行源:qry_Union_Abbreviations从表中提取短名称和ID号。


查询有一个绑定列,字段ID是第一个,它是索引和主键(形式为联盟,我想要打电话)。


所以简单的初学者的任务我自己设定是在这个组合框旁边放了一个小按钮,当点击它时,它将引用组合框中的数据,然后打开另一个表单并转到其值在组合框中命名的记录。


这里是我用于On_Click事件过程的代码:


Private Sub Union_more_Click()

intGlobalVariable = [联名缩写]

DoCmd.OpenForm联盟

DoCmd.GoToRecord ,, acGoTo,intGlobalVariable

End Sub


点击我得到错误号码2498 - 你输入的表达式是一个错误的数据类型参数。


在调试中,我看到acGoTo值为4。 (似乎总是4,无论我从哪个记录开始),而intGlobalVariable是组合框中的文本字符串。


如果我使用strGlobalVariable,它没有任何区别。 />

我已经尝试过在论坛中找到的所有内容,虽然令人沮丧,但体验却很棒。但我肯定知道不能自己解决这个问题。你可以提供任何建议将有助于保持我的理智。


PS如果有任何帮助我正在使用Access 2000和以下代码打开正确的表格,然后去到指定的记录(即7):


Private Sub Union_more_Click()

DoCmd.OpenForm" Unions"

DoCmd .GoToRecord,,acGoTo,7

End Sub


我想我只需要找到一种方法将ID号传递给acGoTo。但是我会让你成为那个判断。
Hi
I''m trying to set up a button which will go to a string value in another form. Too simple, you say?

I have a form called Communications. In it there is a combo box called Abbreviation. This refers to the Row Source: qry_Union_Abbreviations to extract a short name, along with the ID number, from a Table.

The query has one bound column, the field ID is the first one, and it is indexed and a primary key (in the form "Unions" which I''m wanting to call).

So the simple beginner''s task I set myself was to put a little button beside this combo box which, when clicked, would refer to the data in the Combo box and then open up the other form and go to the record whose value was that named in the Combo box.

Here''s the code I have used for my On_Click Event Procedure:

Private Sub Union_more_Click()
intGlobalVariable = [Union Abbreviation]
DoCmd.OpenForm "Unions"
DoCmd.GoToRecord , , acGoTo, intGlobalVariable
End Sub

On click I get error number 2498 - "an expression you entered is the wrong data type for one of the arguments".

In debugging I see the acGoTo value is "4" (seems to be always 4, no matter which record I start from) while the intGlobalVariable is the text string in the combo box.

If I use strGlobalVariable it makes no difference.

I''ve tried everything I''ve been able to find in forums, and the experience has been great, though frustrating. But I know for sure ain''t gonna solve this one on my own. Any suggestions you can offer will help preserve my sanity.

PS If it''s any help I''m using Access 2000 and the following code DOES open the right form, and go to the specified record (ie 7):

Private Sub Union_more_Click()
DoCmd.OpenForm "Unions"
DoCmd.GoToRecord , , acGoTo, 7
End Sub

I think I just need to find a way to pass an ID number to acGoTo. But I''ll let you be the judge of that.





我正在尝试设置一个按钮,该按钮将转换为另一种形式的字符串值。你说太简单了吗?


我有一个名为Communications的表格。其中有一个名为缩写的组合框。这是指行源:qry_Union_Abbreviations从表中提取短名称和ID号。


查询有一个绑定列,字段ID是第一个,它是索引和主键(形式为联盟,我想要打电话)。


所以简单的初学者的任务我自己设定是在这个组合框旁边放了一个小按钮,当点击它时,它将引用组合框中的数据,然后打开另一个表单并转到其值在组合框中命名的记录。


这里是我用于On_Click事件过程的代码:


Private Sub Union_more_Click()

intGlobalVariable = [联名缩写]

DoCmd.OpenForm联盟

DoCmd.GoToRecord ,, acGoTo,intGlobalVariable

End Sub


点击我得到错误号码2498 - 你输入的表达式是一个错误的数据类型参数。


在调试中,我看到acGoTo值为4。 (似乎总是4,无论我从哪个记录开始),而intGlobalVariable是组合框中的文本字符串。


如果我使用strGlobalVariable,它没有任何区别。 />

我已经尝试过在论坛中找到的所有内容,虽然令人沮丧,但体验却很棒。但我肯定知道不能自己解决这个问题。你可以提供任何建议将有助于保持我的理智。


PS如果有任何帮助我正在使用Access 2000和以下代码打开正确的表格,然后去到指定的记录(即7):


Private Sub Union_more_Click()

DoCmd.OpenForm" Unions"

DoCmd .GoToRecord,,acGoTo,7

End Sub


我想我只需要找到一种方法将ID号传递给acGoTo。但我会让你成为那个判断者。
Hi
I''m trying to set up a button which will go to a string value in another form. Too simple, you say?

I have a form called Communications. In it there is a combo box called Abbreviation. This refers to the Row Source: qry_Union_Abbreviations to extract a short name, along with the ID number, from a Table.

The query has one bound column, the field ID is the first one, and it is indexed and a primary key (in the form "Unions" which I''m wanting to call).

So the simple beginner''s task I set myself was to put a little button beside this combo box which, when clicked, would refer to the data in the Combo box and then open up the other form and go to the record whose value was that named in the Combo box.

Here''s the code I have used for my On_Click Event Procedure:

Private Sub Union_more_Click()
intGlobalVariable = [Union Abbreviation]
DoCmd.OpenForm "Unions"
DoCmd.GoToRecord , , acGoTo, intGlobalVariable
End Sub

On click I get error number 2498 - "an expression you entered is the wrong data type for one of the arguments".

In debugging I see the acGoTo value is "4" (seems to be always 4, no matter which record I start from) while the intGlobalVariable is the text string in the combo box.

If I use strGlobalVariable it makes no difference.

I''ve tried everything I''ve been able to find in forums, and the experience has been great, though frustrating. But I know for sure ain''t gonna solve this one on my own. Any suggestions you can offer will help preserve my sanity.

PS If it''s any help I''m using Access 2000 and the following code DOES open the right form, and go to the specified record (ie 7):

Private Sub Union_more_Click()
DoCmd.OpenForm "Unions"
DoCmd.GoToRecord , , acGoTo, 7
End Sub

I think I just need to find a way to pass an ID number to acGoTo. But I''ll let you be the judge of that.

展开 | 选择 < span class =codeDivider> | Wrap | 行号


尝试这样的事情。
Try something like this instead.
展开 | 选择 | Wrap | 行号


这篇关于将身份证号码传递给acGoTo(新手)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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