加载时将新数据添加到accdb数据库 [英] On load form adding new data to accdb database

查看:82
本文介绍了加载时将新数据添加到accdb数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我在Access 2007中将Windows窗体应用程序数据绑定到accdb数据库.现在,我在窗体中输入了用于维护某些清单的数据.我要为每个输入输入唯一的数字,例如:2011_178
其中2011代表当前年份,而178是每个输入的唯一数字

但我希望在加载表单时自动打开文本框中的下一个数字,以便以后可以通过该数字查找特定的输入
所以如果昨天我有几个输入内容
并结束了
使用2011_178,则在下次加载时,它必须显示2011_179,当然我必须有一个保存按钮,因为如果我不保存它,那么将不会保存2011_179,并且下次加载时,它将再次打开该数字.

我有这个应用程序的多个用户,所以我需要自动产生这个数字.

有人可以帮我一些建议吗

Hello

I have windows form application databinded to accdb database in access 2007. now , I have a form where I input data for maintenance of some inventory. Thing is I want to have unique numbers for each of this input for example: 2011_178
where 2011 represents the current year and 178 is unique number for each input

but I want that on load form to opens automaticaly the next number in textbox so that later on I can look for by that number the specific input
so if yesterday I had couple of inputs
and ended
with 2011_178, then on next load it must show 2011_179 and of course I must have a save button because if I don''t save it then 2011_179 wont be saved, and next time I load form it again opens that number.

I have multiple users of this application so the need of automatically producing this number is something I require.

Can anybody help me with some advice

推荐答案

在您的数据库表中使用计数器作为主索引,当您加载查找MAX(yourindexcounter)时,加1并建议作为值在您的文本字段中...:)
Use a counter as primary index in your database table, when you load find MAX(yourindexcounter), add 1 and propose as value in your text field ... :)


这篇关于加载时将新数据添加到accdb数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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