Save form input to a table?

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
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?
 
Back
Top