根据表单上字段中的两个数字向表中插入一组记录 [英] insert a set of records to table based on two numbers from fields on form

查看:57
本文介绍了根据表单上字段中的两个数字向表中插入一组记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天。

我需要以下帮助。


我有一个NewBookEntry表,其中包含字段NumberFrom和NumberTo以及其他一些字段。我在这个表中创建了一个名为NewBookEntry的表单。


我想填写表单上的数字,例如从100到150.然后我想将50条记录插入表中称为DetailHeader并进入字段RefId。它应该插入50条记录,显示100 101 102 ...

我希望能够对表格中的任何给定数字执行此操作,并让它创建记录。

解决方案

Ryno,


首先,我要问一下复制记录的原因。如果您已经有记录,那么您有什么目的来复制数据?可能有正当理由,但问题并不明显。


但是,您希望做的事情很有可能。您可以使用INSERT查询或VBA中的记录集非常简单地完成。两者都应该同样有效 - 这取决于你创建任何一种方法的舒适程度。


告诉我们你想如何继续。


您好。感谢您的回复。

我想为我们在工作中使用的所有书籍注册。我们使用编号的书籍。示例信用簿请求。每本书有50页。像14501到14550.下一本书14551到14600等所以每次发行新书我都希望能够在数据库中创建新书。我使用一个表单填写这个,就像它是什么书,两个字段填写从14501和另一个填写14550.现在我想做的事情是我一旦点击创建并保存此信息代码必须在另一个表中写入50条记录,将第一个数字中的记录命名为最后一个数字。所以将有五十个记录与数字序列。


然后,当书中使用每个号码时,我将创建一个表格转到指定的记录,我将填写我需要的信息。


如果这还不够清楚,请告诉我并试着用不同的方式解释。


谢谢


Ryno,


我想我有点跟着你。但是,我必须要问,如果你创建这本Credit Book,总会使用50页吗?请记住,我仍然没有完全遵循这个DB的内容。我想弄明白这一点。我最初的想法是没有必要真正创建50条新记录。只要为每本书使用它,只需为每本书创建一个新记录,将页码增加一个。


因此,例如,您可能有一个具有第一个页面的书籍;如14501.您编辑该记录。然后你有另一本书有页面的书。编号103.您编辑该页面。接下来,您将返回到Credit Book,然后为第14502页创建新记录。依此类推。请记住,除非有特定原因,否则每个书籍都会出现。必须有一定数量的页面那么在您真正需要该记录之前,这是浪费资源。有意义吗?


但是,你可以按照你的要求去做。我只是想首先引导你学习DB原理,但是DB设计的最终决定取决于你!


Good day.
I need help on the following.

I have a table NewBookEntry with fields NumberFrom and NumberTo and a few other fields as well. I created a form from this table also called NewBookEntry.

I want to fill in numbers on the form for example from 100 to 150. Then i want to insert the 50 records to a table called DetailHeader and into field RefId. It should insert 50 records showing 100 101 102...
I want to be able to do this with any given numbers in the form and let it create the records.

解决方案

Ryno,

First, I have to ask about the reason for copying the records. If you have the records already, what purpose do you have for making a duplication of the data? There may be a valid reason, but that is not apparent from the question.

However, what you wish to do is very possible. You could do it very simply with an INSERT Query or via a recordset in VBA. Either should work equally well--it just depends on how comfortable you are with creating either method.

Let us know how you would like to proceed.


Hi. Thanks for your reply.
I wan to make a register for all our books we use at work. We use numbered books. Example a request for credit book. Each book has 50 pages. Like 14501 to 14550. Next book 14551 to 14600 etc. So each time a new book is issued i want to be able to create the new book in the database. I use a form to fill this in like what book it is, the two fields to fill in the from 14501 and another to fill in 14550. Now the thing i want to do is as soon as i click to create and save this info the code must write the fifty records in another table naming the records from the first number to the last number. So there will be fifty records with the sequence of numbers.

Then as each number is used in the book i will create a form to go to the specified record and i will fill in the info i need.

If this is not clear enough please let me know and ill try and explain a different way.

Thanks


Ryno,

I think I am kind of following you. But, I must ask, if you create this Credit book, will 50 pages always be used? Keep in mind, I am still not quite following what this DB is about. I''m trying to figure that out. My initial thought is that there is no need to really create 50 new records. Just create a new record for each book whenever you use it, incrementing the page number by one.

So, for example, you may have a Credit Book that has the first "page" as 14501. You edit that record. Then you have another book that has "page" number 103. You edit that page. next, you go back to the Credit Book, and then you create a new record for page 14502. And so on. Keep in mind that unless there is a specific reason why each "book" must have a certain number of "pages" then it is a waste of resources until you actually need that record. Make sense?

However, you can do it the way you are asking. I''m just trying to guide you to good DB principles first, but the ultimate decisions on DB design are up to you!


这篇关于根据表单上字段中的两个数字向表中插入一组记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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