Go Back   Access World Forums > Microsoft Access Discussion > Forms

Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 08-17-2011, 11:13 PM   #1
Newly Registered User
Join Date: Aug 2011
Location: Fresno, California
Posts: 76
Thanks: 16
Thanked 0 Times in 0 Posts
chappy68 is on a distinguished road
Problem with button coding

I have a seemingly simple issue. I have a field in a form that requires a unique value. It is set in the table properties as index (no duplicates). When I click the button I should get an error message as it tries to save the record. I am not getting the error message and the focus is set on the field ClientName. I have copied the code behind the button below.

What am I missing?

I am using Access 2007 on Windows 7.

' butSaveNewOnNewClient_Click
Private Sub butSaveNewOnNewClient_Click()
On Error GoTo butSaveNewOnNewClient_Click_Err
On Error Resume Next
DoCmd.RunCommand acCmdSaveRecord
DoCmd.GoToRecord , "", acNext
If (MacroError <> 0) Then
MsgBox MacroError.Description, vbOKOnly, ""
End If

Exit Sub
MsgBox Error$
Resume butSaveNewOnNewClient_Click_Exit
End Sub

chappy68 is offline   Reply With Quote

button , error message , vb code

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
button coding hayden Forms 5 03-17-2010 08:51 AM
Print button coding problem Sonny Jim Reports 3 01-26-2007 10:56 PM
Button coding Matt Brown Forms 0 04-24-2003 12:48 AM
coding command button alguzman Modules & VBA 6 06-19-2002 08:49 AM
[SOLVED] Trouble Coding A Browse Button deneice2 Modules & VBA 2 02-14-2001 03:22 PM

All times are GMT -8. The time now is 09:16 PM.

Microsoft Access Help
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post

Sponsored Links

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World