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

Error Handling on ODBC Linked Tables (odbc error)

Status
Not open for further replies.

sisieko

Programmer
Jun 13, 2004
56
US
My tables are sybase linked tables to my Access front end. I get this error whenever i click away from my mainform while my not-null fields (textboxes) have not been entered. So, i would like to put an error message "somewhere" that tells the user to fill in the necessary fields and highlight the necessary textboxes in red, instead of this scary ODBC message

When i put my error handling in the afterUpdate or afterInsert Event. I still get the above error msg instead of my msgbox.
Where do i put this message? or should be question be, "what the proper way to handle this intimidating error? :)

Here's my error handling:
Code:
On Error GoTo Err_Form_AfterInsert
  
  'do something

    
Exit_Form_AfterInsert:
    Exit Sub

Err_Form_AfterInsert:
    MsgBox Err.Description, vbExclamation, "Please enter the Project Name, Project Leader Initials, Main User and Status Code" & Err.Number
    Me!Combo67.BackColor = "red"
    Me!Combo65.BackColor = "red"
    Me![Project Name].BackColor = "red"
    Me![Project Leader Initials Combo].BackColor = "red"
    Resume Exit_Form_AfterInsert

Thanks in advance for your help :D
 
You could try the Form_BeforeInsert or Form_BeforeUpdate. You may have to manually check each field to be non-blank then shove out your own message if any are blank.
 
Thanks BuilderSpec...I just tried that. Still no luck

 
Hi

Try using the cancel property on the Form_BeforeUpdate routine.

Do some checking to see if the fields have correct values etc, if they don't then say

Cancel = -1

this will prevent the data being updated with invalid values...you can shove out your own message at this point. All this will occur before the ODBC stuff has a chance to ruin it with it's horrible message.

Regards

BuilderSpec
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top