使用库存输入文本框上的分隔符创建多个条目 [英] Using a Delimiter on an inventory input text box to create multiple entries

查看:61
本文介绍了使用库存输入文本框上的分隔符创建多个条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

早上好,

我正在制作一个项目,我正在尝试制作一个项目访问库存数据库。他们有一台扫描仪可以扫描多个输入,然后将这些输入全部传输到一个位置,例如单元格或文本框。 

I am currently working on a project at my work in which i'm trying to make an inventory database on access. They have a scanner that can scan multiple inputs and then transfer those inputs all at one to a location, such as a cell or a textbox. 

制作一个表格相当容易由一个用于输入单个数据的文本框组成,但是这个数据一次用于由制表符分隔符分隔的一组数据。我想知道实现这个目标的最佳方法是什么?从我发现split()
似乎很有希望我只是不确定如何实现它或者还有其他方法。谢谢!!

It's fairly easy to make a form that consists of a text box to input individual data, however this one works for one set of data at a time separated by a tab delimiter. I'm wondering what the best way to go about achieving this is? From what i've found split() seems to be promising i'm just not sure how to implement it or if there are other ways. Thank you!!

示例:当前 - 在文本框中输入'data1'并点击保存,在文本框中输入'data2'并在同一

Example: Currently - enter 'data1' in textbox and hit save, enter 'data2' in textbox and at same

我想: - 输入'数据1   数据2    data3'点击保存,保存为单独的记录,数据1,数据2,数据3。

I want to get to: - enter 'data 1    data 2     data3' hit save, saves as seperate records, data 1, data 2, data 3.

推荐答案

你必须写一些VBA沿着这些方向:

dim s()as string

dim sElement as string

s = split(Me.myTextbox,vbTab)

 每个sElement的
CurrentDB.Execute"insert into myTable(myField)values('"& sElement&"');",dbFailOnError

next

You will have to write some VBA along these lines:
dim s() as string
dim sElement as string
s=split(Me.myTextbox, vbTab)
for each sElement in s
  CurrentDB.Execute "insert into myTable(myField) values('" & sElement & "');", dbFailOnError
next

(当然你用你的myObjectNames替换)

(of course you replace myObjectNames with yours)


这篇关于使用库存输入文本框上的分隔符创建多个条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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