From: adamskiii on
I am new to Access and was wondering how I would save a record from my forum
to the database. I am using an unbound forum.

Thanks
From: Al Campagna on
adamskiii,
Why have you created an "unbound" form to operate on a table?

If you're new to Access, you've just made your project much more
difficult than it needs to be.

You'll need to create a button on your form that, when clicked, runs
an Append query against your table, using the current values on the open
form.
--
hth
Al Campagna
Microsoft Access MVP 2007-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

"adamskiii" <adamskiii(a)discussions.microsoft.com> wrote in message
news:03CDA087-95EA-4B51-8D1D-9F73B368C323(a)microsoft.com...
>I am new to Access and was wondering how I would save a record from my
>forum
> to the database. I am using an unbound forum.
>
> Thanks


From: Maurice on
You would probably open the recordset and write the values from the form to
the table for example:

Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset

With rst
.Open "YourTable", CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
.AddNew
.Fields("tablefieldname") = Me.textboxonform
.Fields("tablefieldname") = Me.textboxonform
.Fields("tablefieldname") = Me.textboxonform
'etc...
.Update
.Close
End With

Set rst = Nothing

replace the "tablefieldname" with the names which you use in the table for
your fields
Replace the "Me.textboxonform" with the names of the textbox controls you
are using on your form.

hth

--
Maurice Ausum


"adamskiii" wrote:

> I am new to Access and was wondering how I would save a record from my forum
> to the database. I am using an unbound forum.
>
> Thanks
From: adamskiii on
I have made my form with the code to display data from the table but am not
show how to code a button to save the data I edit back to the table. This is
my code so far:


Option Explicit
Option Compare Database

Dim connection As New ADODB.connection
Dim part As New ADODB.Recordset



Private Sub Form_Load()
Set connection = CurrentProject.connection
part.Open "SELECT * FROM part ORDER BY partID", connection, _
adOpenDynamic, adLockOptimistic

populateForm
End Sub


Private Sub populateForm()
If part.EOF Then
part.MoveLast
ElseIf part.BOF Then
part.MoveFirst
End If

Me.txtPartId = part.Fields("partId")
Me.txtCost = part.Fields("cost")
Me.txtDescription = part.Fields("description")
Me.txtOnHand = part.Fields("onHand")
Me.txtOnOrder = part.Fields("onOrder")
Me.txtListPrice = part.Fields("listPrice")
End Sub


What would I need to add to save a record I edit on my form to a table?

Thanks
From: Jack Leach dymondjack at hot mail dot on
What kind of backend are you using? I assume this is an MSAccess database as
nothing has been noted otherwise... if this is in fact the case, then there
is no reason whatsoever to be using any recordset an all, let alone using ADO!

As Al said, you are going the looooooong way around. If you have a standard
ms access table and form, just use the wizard to make a form that is bound,
and all of this is taken care of for you (using Access's native DAO, not ADO).

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



"adamskiii" wrote:

> I am new to Access and was wondering how I would save a record from my forum
> to the database. I am using an unbound forum.
>
> Thanks