这应该很简单,对吧? [英] This should be easy, right??

查看:65
本文介绍了这应该很简单,对吧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我遇到一个你认为容易做的问题的最难的时刻!但是,作为一个访问菜鸟,我似乎无法让它工作。 Access 2000.


我所拥有的是用于基本上将记录输入表格的表单中的选项卡。它现在设置了一个文本框,用户将在其中输入客户端名称(txt_client),客户端TIN(txt_TIN)的字段,文档类型(cmb_type)的combox。我有一个链接到模块的按钮,它会打开一个浏览器窗口供用户选择他们保存的文件,然后在选中时,路径显示在隐藏文本框(txt_loc)中。我想将用户输入的所有信息输入到相应的表(tbl_doc)中。


我也想格式化显示格式路径的文本框。我的意思是当路径显示在txt_loc中时,它显示C:\ path \ path \ _document.pdf,例如,文档所在的驱动器是服务器上的共享驱动器。所以我想将C:\替换为服务器上的实际驱动器名称,例如将C:\替换为\\mappeddrive\\\
ame \ path \ document.pdf。与txt_loc对应的列是表中的主键,如果这会产生影响。


我尝试使用连接创建一个记录,并尝试更新按钮的事件过程中的sql语句。我无法为我的生活工作。任何帮助都会非常感激!!

Hi everyone,

I''m having the hardest time with an issue that you would think to be easy to do! But, being an access noob, I can''t seem to get it to work. Access 2000.

What I have is a tab within a form used to basically input records into a table. It''s set up now with one text box where the user will enter the clients name (txt_client), a field for the clients TIN (txt_TIN), a combox with the document type (cmb_type). I have a button linked to a module that brings up an explorer window for the user to select the file they saved, then when selected the path displays in a hidden text box (txt_loc). I''d like to input all of the information the user enters into the corresponding table (tbl_doc).

I''d also like to format the text box displaying the path with a format. What I mean is when the path is displayed in txt_loc, it shows C:\path\path\document.pdf for example, the drive the documents are on is a shared drive on a server. So I''d like to replace C:\ with the actual drive name on the server, for example replace C:\ with \\mappeddrive\name\path\document.pdf. The column that corresponds with the txt_loc is the primary key in the table if that makes a difference.

I''ve tried creating a recordet, using a connection and tried with just a update sql statement in the event procedure of the button. I can not get the thing to work for the life of me. Any help would be GREATLY appreciated!!

推荐答案

是否有一个非常的理由,为什么你做了一个潜在的非唯一值这个表的主键?因为,除非有一个真正的真正的好理由,否则这是一个坏主意!


错误输入的文档名称,路径,重复文档等都可能导致未处理的错误,沮丧的用户和潜在的数据损坏,从而造成严重破坏。


我强烈建议创建一个单独的字段(列)作为主键值。自动编号数据类型是此类字段的标准,但您不一定非必须使用它。


这是否也会消除您在隐藏文本框中引用路径的需要?我使用带有主键值的隐藏文本框主要是为了在连续视图中使用表单时引用当前记录。这是你在尝试什么?


问候,

Scott
Is there a really really good reason why you have made a potentially non-unique value the primary key of this table? Because, unless there''s a really really good reason, it''s a bad idea!

Mis-typed document names, paths, duplicate documents, etc can all wreak havoc by causing unhandled errors, frustrated users, and potential data corruption.

I would highly suggest creating a separate field (column) to use as the primary key value. Autonumber data type is the standard for such a field, although you don''t necessarily have to use it.

Would this also do away with your need to refer to the path in a hidden text box? I use hidden text boxes with the primary key value mainly to refer to the current record when using a form in continuous view. Is this what you are attempting?

Regards,
Scott



是否有一个非常的理由,为什么你将一个潜在的非唯一值作为该表的主键?因为,除非有一个真正的真正的好理由,否则这是一个坏主意!


错误输入的文档名称,路径,重复文档等都可能导致未处理的错误,沮丧的用户和潜在的数据损坏,从而造成严重破坏。


我强烈建议创建一个单独的字段(列)作为主键值。自动编号数据类型是此类字段的标准,但您不一定非必须使用它。


这是否也会消除您在隐藏文本框中引用路径的需要?我使用带有主键值的隐藏文本框主要是为了在连续视图中使用表单时引用当前记录。这是你在尝试什么?


问候,

Scott
Is there a really really good reason why you have made a potentially non-unique value the primary key of this table? Because, unless there''s a really really good reason, it''s a bad idea!

Mis-typed document names, paths, duplicate documents, etc can all wreak havoc by causing unhandled errors, frustrated users, and potential data corruption.

I would highly suggest creating a separate field (column) to use as the primary key value. Autonumber data type is the standard for such a field, although you don''t necessarily have to use it.

Would this also do away with your need to refer to the path in a hidden text box? I use hidden text boxes with the primary key value mainly to refer to the current record when using a form in continuous view. Is this what you are attempting?

Regards,
Scott



嗨斯科特,

不,老实说,我没有任何理由将路径作为主键。我想我认为我希望这是独一无二的,以防止人们提交多条记录。在此之前,我根本没有主键,自动编号可以正常工作。我会改用它。 :)


我只是隐藏了隐藏文本框中的路径,因此表单看起来更加流线型给用户。我最终试图将路径放到表格的相应记录中,我只是无法弄清楚如何将这些信息直接从打开的窗口浏览器传输到表格。我已经成功地以相反的方式将一条路径从表格转移到一个隐藏的文本框,所以我认为实现这个目标会更容易相反。


谢谢你的帮助!

Hi Scott,
No, there honestly isn''t any reason why I made the path the primary key. I guess I was thinking I wanted that to be unique to keep people from submitting multiple records. Before, I didn''t have a primary key at all, an autonumber would work just fine. I will use that instead. :)

I''m hiding the path in a hidden text box only so the form looks more streamline to the users. I''m ultimately trying to get the path into the appropriate record of the table, I just couldn''t figure out how to transfer that information directly from the open window explorer to the table. I''ve had success transfering a path from the table to a hidden text box in an opposite manner, so I figured it would be easier to do the opposite to achieve this goal.

Thanks for the help!


我看,我认为:-)

这里是一个讨论打开文件对话框的链接。您需要访问对话框的.SelectedItems集合以捕获它包含的路径。如果您需要更多帮助,请告诉我们!


问候,

Scott
I see, I think :-)

Here is a link that discusses the open file dialog box a bit. You need to access the .SelectedItems collection of the dialog box to capture the path it contains. Let me know if you need more help!

Regards,
Scott


这篇关于这应该很简单,对吧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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