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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save current record in form...

Status
Not open for further replies.

twinmill

Programmer
Apr 4, 2001
31
GU
I have a form with recordsource based on a query to a table. At startup, I turn off all menus and toolbars except the default shortcut menus.

In the form, I created a button with an On Click event to save the current record:

DoCmd.RunCommand acCmdSaveRecord

When I run it, I get the following error:

You can't reference a property or method for a control unless the control has the focus.

Why do I get this error, and is there a better way to save the current record?
 
Found why the error was coming up. It had nothing to do with the DoCmd.RunCommand acCmdSaveRecord.

It was caused by a bug in an If statement where one of my conditions used "me!txtField.Text" and I changed the "Text" to "Value", and now everything works fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top