New here, so be gentle with me. - edited to simplify
新来的,所以要对我温柔。 - 编辑简化
I'm trying to set up something in Access where:
我正在尝试在Access中设置一些内容:
- user selects driver name and date
- 用户选择驱动程序名称和日期
- query finds stops along the driver's route
- 查询沿着驱动程序的路径查找停靠点
- form opens with route stops (location details) filled in and user can add additional information (item picked up, weight of item)
- 表格打开时填写了路线停靠点(位置详细信息),用户可以添加其他信息(物品拾取,物品重量)
- all information gets transferred to a "Pickups" table, which has data on what was picked up, the weight, where (route stop) and by whom (driver).
- 所有信息都被传送到“皮卡”表,其中包含所拾取内容,重量,位置(路线停止)和由谁(驾驶员)的数据。
I have stores A through H, and three drivers, Bob, Tom, and Jill. Bob’s route is stores A,B,C,D. Tom’s route is stores A,C,G,H, and Jill’s route is stores D,E,F,G. (I can't give real names/locations - work is very strict about privacy issues!)
我有A到H的商店,还有三个司机,Bob,Tom和Jill。鲍勃的路线是商店A,B,C,D。汤姆的路线是商店A,C,G,H,而吉尔的路线是商店D,E,F,G。 (我无法提供真实姓名/地点 - 关于隐私问题的工作非常严格!)
Behind these are “Driver” Table, with driver name, ID, and truck info; and “Store” Table, with store name (A-H), address, phone number, and contact person.
在这些背后是“驾驶员”表,包含驾驶员姓名,身份证和卡车信息;和“商店”表,包含商店名称(A-H),地址,电话号码和联系人。
We’re collecting all of the information about items picked up at each store into a “Pickup” table, with Fields: Date, Driver, Store, WeightOfFurniture, WeightOfBooks, WeightOfClothes
我们将每个商店收集的所有商品信息收集到“Pickup”表中,其中包括Fields:Date,Driver,Store,WeightOfFurniture,WeightOfBooks,WeightOfClothes
The user starts with the driver’s name and date, clicks a button, and this opens a form with the following fields:
用户从驱动程序的名称和日期开始,单击按钮,这将打开一个包含以下字段的表单:
Driver, Date, Store, WeightOfFurniture, WeightOfBooks, WeightOfClothes with driver and date filled in based on the initial entry, and “Store” having all listings for a given driver’s route. So I select Bob and a date (11-12) and get a form with:
驱动程序,日期,存储,WeightOfFurniture,WeightOfBooks,基于初始条目填写的驱动程序和日期的WeightOfClothes,以及具有给定驾驶员路线的所有列表的“商店”。所以我选择Bob和一个日期(11-12)并获得一个表格:
Name Date Store WtFurn WtBooks WtClothes
名称日期商店WtFurn WtBooks WtClothes
Bob 11-12 A
鲍勃11-12 A.
Bob 11-12 B
鲍勃11-12 B.
Bob 11-12 C
鲍勃11-12 C.
Bob 11-12 D
鲍勃11-12 D.
I can get the above information from a query without any problem, but I can't figure out how to (partially) fill the form with the query results (there will be multiple query results for a given route, so DLookup is not useful).
我可以毫无问题地从查询中获取上述信息,但我无法弄清楚如何(部分)用查询结果填充表单(给定路由会有多个查询结果,因此DLookup没用) 。
I think recordsets might be a way to go, but not sure how to do this. I'm very new at VBA, but am learning (the hard way!).
我认为记录集可能是一种方法,但不知道如何做到这一点。我在VBA很新,但我正在学习(艰难的方式!)。
Any suggestions?
有什么建议么?
Thanks!
谢谢!
1 个解决方案
#1
0
Use an INSERT INTO
action query to insert those records into your Pickup
table.
使用INSERT INTO操作查询将这些记录插入到分拣表中。
I can get the above information from a query without any problem,
我可以毫无问题地从查询中获取上述信息,
This query is the SELECT FROM part for the INSERT query.
此查询是INSERT查询的SELECT FROM部分。
Then open your Pickup form, filtered for Driver, Date and Store that you just inserted.
然后打开您的分拣表单,过滤您刚插入的驱动程序,日期和存储。
#1
0
Use an INSERT INTO
action query to insert those records into your Pickup
table.
使用INSERT INTO操作查询将这些记录插入到分拣表中。
I can get the above information from a query without any problem,
我可以毫无问题地从查询中获取上述信息,
This query is the SELECT FROM part for the INSERT query.
此查询是INSERT查询的SELECT FROM部分。
Then open your Pickup form, filtered for Driver, Date and Store that you just inserted.
然后打开您的分拣表单,过滤您刚插入的驱动程序,日期和存储。