Save form input to a table?

G

Guest

I have created a form with these 5 fields Txtdate, txtname, txtaddress,
txtphone and txtfax. When I enter these fields I want to save it back to the
table i've created called members which have the same names as the field
names on the form. This is what I have done so far
option explicit
dim rst as recordset
dim db as database
dim count as integer

in the save command i have

Private sub cmdsave_click()
set db = current db
if xcount = o then
set rst = db.openrecordset("select * from members")
with rst
..addnew
!txtdate = txtdate
!txtname = txtname
!txtaddress = txtaddress
!txtphone = txtphone
!txtfax = txtfax
..update
end with
rst.close
db.close
end sub

unknown to me this doesn't work. Please help?
 
R

Rick Brandt

rob said:
I have created a form with these 5 fields Txtdate, txtname, txtaddress,
txtphone and txtfax. When I enter these fields I want to save it back to the
table i've created called members which have the same names as the field
names on the form. This is what I have done so far
option explicit
dim rst as recordset
dim db as database
dim count as integer

in the save command i have

Private sub cmdsave_click()
set db = current db
if xcount = o then
set rst = db.openrecordset("select * from members")
with rst
.addnew
!txtdate = txtdate
!txtname = txtname
!txtaddress = txtaddress
!txtphone = txtphone
!txtfax = txtfax
.update
end with
rst.close
db.close
end sub

unknown to me this doesn't work. Please help?

if xcount = o then

The above is the letter "o". I assume it should be the digit zero. Was that
just a typo in your post?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top