多个列表框和多个项目到访问表 [英] Multiple Listbox and multiple items to ACCESS Table

查看:81
本文介绍了多个列表框和多个项目到访问表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在ACCESS表单中有2个日期字段(date1和date2)和3个列表框(Listb1,LIstb2和ListB3)。

我在尝试什么要做的是在日期字段中选择日期,从每个列表框中选择2个项目并尝试将其保存到表格中。我需要将date1,Listb1 item1,Listb2 item1和Listb3 item1保存为一个记录,将date2,Listb1 item2,Listb2 item2和Listb3 item2保存为另一条记录。

我正在使用的代码如下所示:

Hi
I have 2 date fields (date1 and date2)and 3 listbox (Listb1, LIstb2, and ListB3) in an ACCESS form.
What I am trying to do is select dates in the date fields, select 2 items from each listbox and trying to save it to a table. I need the date1,Listb1 item1, Listb2 item1 and Listb3 item1 to be saved as one record and date2,Listb1 item2, Listb2 item2 and Listb3 item2 to be saved as another record.
The code I am using is as below:

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

推荐答案

rajeevs,你能更具体地解决这个问题吗?只是说它不起作用并不是很有用。发生了什么?


我从未尝试过基于递增日期的for / next循环。那样有用吗?您可能希望停止调试器以检查n是否正确递增。


Jim
rajeevs, could you be more specific about the problem? Just saying it doesn''t work is not very informative. What is happening?

I have never tried a for/next loop based on incrementing a date. Does that work? You might want to stop the debugger to check if n is incrementing correctly.

Jim


您好jimatqsi

对不起,我很抱歉。我在最近两天下班了。

这是从某个地方复制的代码。

我想要做的是:表单中有两个日期选择(从和到日期)和3个列表框,可用于选择多个项目(列表框为listbox1,listbox2和listbox3) 。如果所选日期的持续时间为5,则项目数将等于该计数。

例如:如果date1为01-01-15且date2为05-01-15,则用户将选择列表框中有5个项目。在选择之后,我喜欢将5条记录放入表中:

record1 with date 01-01-15 listbox1 item1 listbox2 item1 listbox3 item1。记录2将与日期01-01-05和listbox1 item2,listbox2 item2和listbox3 item2。

Record3与日期03-01-15和列表框项目3

记录4日期04-01-15和列表框项目4和记录5日期05-01-15和列表框项目5

希望我解释得很好。任何根据我的要求修改代码的帮助将不胜感激。

谢谢
Hi jimatqsi
Sorry for the delay. I was off duty during the last two days.
That was a copied code from somewhere.
What I want to do is : there will be two date selections in the form (from and to dates) and 3 listboxes which can be used to select multiple Items (listboxes as listbox1, listbox2 and listbox3). If the duration of dates selected is 5 then the count of items will be equal to that count.
eg: if date1 is 01-01-15 and date2 is 05-01-15 the user will select 5 items from the listboxes. After the selections I like to put 5 records into the table as :
record1 with date 01-01-15 listbox1 item1 listbox2 item1 listbox3 item1. Record 2 will be with date 01-01-05 and listbox1 item2, listbox2 item2 and listbox3 item2.
Record3 with date 03-01-15 and listbox items 3
record 4 with date 04-01-15 and listbox items 4 and record 5 with date 05-01-15 and listbox items 5
Hope I explained well. Any help to modify the code according to my requirement will be appreciated.
Thank you


您好


我有修改了如下代码。现在我的问题是第一条记录正确写入,但第二条记录除日期外正确写入所有内容。在第二条记录中,我需要编写edate1。

任何帮助?
Hi

I have modified the code as below. Now my problem is the first record writes correctly but the second record writes everything correctly except the date. In the second record I need the edate1 to be written.
Any help?
展开 | 选择 | Wrap | 行号


这篇关于多个列表框和多个项目到访问表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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