[英]setting global variables in MS Access
I have been searching the internet for hours but have yet to figure out what I am doing wrong. 我已经在互联网上搜索了几个小时,但是还没有弄清楚我在做什么错。 I have created a login form, which has a combobox for user name and a text box for the password.
我创建了一个登录表单,其中有一个用于用户名的组合框和一个用于密码的文本框。 I need to save the user name for future use, so I have created a new module and in it a global variable for the name:
我需要保存用户名以备将来使用,因此我创建了一个新模块,并在其中创建了一个名称的全局变量:
Option Compare Database
期权比较数据库
Option Explicit
显式期权
Public Name As String
公用名称为字符串
I am trying to set a value in a private sub into this variable like this: 我试图像这样在变量中的私有子集中设置一个值:
Name = Me.cmbClient.Value
名称= Me.cmbClient.Value
but i keep getting this error "run-time error '2135': this property is read-only and can't be set" I have no idea what I am doing wrong. 但是我一直收到此错误“运行时错误'2135':此属性为只读且无法设置”,我不知道自己在做什么错。 I would really appreciate it if someone could help.
如果有人可以提供帮助,我将不胜感激。
名称是VBA中的保留字。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.