有关如何从表格自动填充和自动编号表单的问题。 [英] Questions regarding how to autofill and autonumber a form from a table.

查看:86
本文介绍了有关如何从表格自动填充和自动编号表单的问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我是非常新的访问(大约一个星期我一直在这个数据库上工作),我正在尝试创建一个数据库来跟踪我工作的公司的工作。我的访问布局方面布局得相当好,但我在Access的编程方面遇到了麻烦。我有一个主表,信息将来自tblCustomers。这包含我想要在我附加的表单上显示的信息。基本上我想使用客户名称下的下拉菜单。在表格上。当我选择某个公司时,我需要其他相关信息,例如客户ID,联系人,街道,城市,州和邮政编码。自动填充tblCustomers中包含的信息。这就是我想要它做的事情,但是我对如何开始工作有些迷茫。我已经读过dlookup命令应该做我需要的,但是,我不确定。这就是为什么我来到脚本,请帮忙。我感谢您提供的任何信息,或指向我。在自动填充工作之后,我想要开始工作的另一个项目是我希望Job#字段自动填写一个正数范围内的唯一数字,比如5个小数位0 - 99999?再次感谢您提供的任何帮助。


表格的图片。

Hello, I''m very new to access (about a week I''ve been working on this database) and am trying to make a database to track jobs for a company I work for. I''ve got the layout side of access laid out fairly well, but I''m having trouble with the programming side of Access. I''ve got one main table that the information will be pulling from called tblCustomers. This contains the information that I want to display on the form I''ve attached. Basically I''d like to use a drop down menu under "customer name" on the form. When I select a particular company I need the other related information such as "Customer ID, Contact, Street, City, State, and Zip Code" to automatically fill from the information contained in tblCustomers. This is what I''d like it to do, however I''m somewhat lost on how to go about getting that working. I''ve read that the dlookup command should do what I need, but again, I''m not sure. This is why I''ve come to theScripts, please help. I appreciate any information you can give, or point me toward. One other item I''d like to get to work after getting the autofill to work is that I''d like the Job # field to automatically fill out with a unique number within a range of positive numbers, say 5 decimal places 0 - 99999? Thank you again for any help you can provide.

Picture of the Form.

推荐答案

好吧,慢慢但肯定我正在取得一些进展。虽然已经开始使用与客户ID相同的信息填写联系信息,但我能够将客户ID自动填充。无论如何,我将如何在同一事件中设置另一个命令?有没有我可以使用的分隔符,或者只是另一行来键入代码的下一部分?


感谢您提供的任何帮助,

- Jim
Alright, slowly but surely I''m making some progress. I was able to get the Customer ID to autofill, although it has started to fill the Contact information with the same info as the Customer ID. Eitherway, how would I go about setting another command in the same event? Is there a divider I can use, or simply another line to type the next part of the code?

Thank you for any help you can provide,
- Jim


首先你需要考虑你的表格及其关系的构造。

假设一个Orderform,这将基于tblOrder,但也与客户有关系。

要获得客户详细信息,您可以轻松添加一个链接到tblOrder的CustomerID的子表单,而Access将同步Customerdata。


当您在frmOrder上创建一个组合框以从客户表中查找客户时,子窗体的数据也会在选择另一个客户后发生变化。


或许有必要查看Access附带的Northwind示例数据库和/或可以从MS站点下载。


Nic; o)
First you need to think about the construction of your tables and their relations.
Assume an Orderform, this will be based on a tblOrder, but also have a relation to a Customer.
To get the Customer details you can easily add a subform that''s linked to the CustomerID of the tblOrder and than Access will synchronize the Customerdata.

When you make the CustomerID on the frmOrder a combobox to lookup Customers from your customer table, the data of the subform will also change after the selection of another Customer.

Perhaps it''s worthwhile to look into the Northwind sample database that comes with Access and/or can be downloaded from the MS site.

Nic;o)


谢谢你的帮助Nic,我是abl e使子表单工作(不知道子表单选项)。非常感谢您的帮助。现在我需要弄清楚如何做一个自动编号系统,它具有一定数量的小数位数,并以增量计数,并且在数据库压缩和修复后不会丢失计数。数字长度必须为5-6位,不重复等。它还需要以空白数字区域的0'开头,例如。而不仅仅是数字1,它需要是00001.这些将成为工作号码。如果你能指出我在这方面的正确方向,我会很感激。再次感谢您。


这是更新后的表格。

Thanks for your help Nic, I was able to get the sub form to work (wasn''t aware of a subform option). Thank you very much for your help. Now I need to figure out how to do an autonumber system that has a set number of decimal places and counts in increments and will not lose count after a database compact and repair. The number needs to be 5-6 digits in length, non-repeating, etc. It also needs to start with 0''s in blank digit areas, ex. instead of just the number 1, it needs to be 00001. These will become job numbers. If you could point me in the right direction in that regard, I''d appreciate it. Thank you again.

Here''s the updated form.


这篇关于有关如何从表格自动填充和自动编号表单的问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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