Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Thanks PaulBricker for the code. I'm having a problem with 1

Status
Not open for further replies.

seawave

Technical User
Oct 21, 2002
30
US
Paul, below is the coding you provided to me.
I'm not certain what I've done wrong...I added the coding to the AddNew command button, however, I get a "compile error - user defined type not defined" and the first line
of coding is highlighted in blue.
I'm new to the board, so I'm not for sure if I was suppose to post a new message or reply to your answer in my original request.
Thanks again for any help you can offer.
Seawave
__________________________________________________________
Paul wrote:

Dim rst as DAO.Recordset
Dim frm as Form
Set frm = Forms!YourFormName
Set rst = CurrentDb.OpenRecordset("Cable Table",dbOpenDyanset)
rst.AddNew
rst!CableName = frm.textboxname
rst!NextField = frm.nextfield
rst!SomeOtherField = frm.someotherfield
rst.Update

frm.textboxname = Null
frm.nextfield = Null
frm.someotherfield = Null

set frm = Nothing
set rst = Nothing

_________________________________________________________
 
Hi Seawave!

You need to set a reference to DAO. In the code window click on Tool/References. Find the reference to Data Access Objects 3.6 and put a check in the box beside. Click okay and your error message should go away.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Seawave, the best thing to do is stay with the original post. That way, all the original information is in one place. If Jeff's suggestion doens't help, post which version of Access you are using.
Paul
 
Thanks Jeff.
Thanks Paul for the tip on replying to posting.

Jeff's suggestion did enable me to resolve that coding problem.
However, I have another compile error -variable not defined
on the line of code ending with dbOpenDyanset.
dbOpenDyanset is highlighted with the error message.

I am using Access 2000.
 
It's a typo. It should be dbOpenDynaset. The a and n are reversed.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top