469,631 Members | 1,218 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

How to manually save form data

How can I manually save information entered on a form onto a table? The form
information is derived from different tables. I want to inter the resulting
information into another table. Please help. Thanks.

--
Message posted via http://www.accessmonster.com

Oct 18 '07 #1
1 5390
On Oct 18, 1:08 pm, "dufnobles via AccessMonster.com" <u37896@uwe>
wrote:
How can I manually save information entered on a form onto a table? The form
information is derived from different tables. I want to inter the resulting
information into another table. Please help. Thanks.

--
Message posted viahttp://www.accessmonster.com
With an unbound form, a Save button or a Save and Exit button is
typical. In its click event you would put something like the
following:

private sub cmdSave_click( )
dim db as database
dim rs as recordset
set db=currentdb( )
set rs=db.OpenRecordset("tblNew",dbOpenTable)
rs.addnew
rs!Name=txtName
rs!Address=txtAddress
rs!Phone = txtPhone
rs.update
rs.close
set rs=nothing
db.close
set db=nothing
End Sub

If the record is not new, but an edit of an existing record, then you
would use rs.edit instead of rs.addnew, and you would have to find the
record first. If it is type dbOpenTable, as is the example, then you
would use a seek statement. Otherwise, if it does not have an index
use a dbOpenDynaset instead of dbOpenTable and use a findfirst
statement.

rs.seek "=",txtName
if not rs.NoMatch then
...
or
rs.findfirst "Name=' " & txtName
if not rs.NoMatch then
...

Oct 18 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Andras Gilicz | last post: by
5 posts views Thread by C Watson | last post: by
reply views Thread by amrhi | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.