Solved

Customizing Menu Items in MS Access 2003

Posted on 2008-10-18
6
303 Views
Last Modified: 2013-11-27
I have created a Find Records control on a Form. When the user enters a value that is not in the database, the message "Microsoft Access has finished searching the records....."  When I create the control on a different form, I get no message at all.  

How doI edit either form, so that a dialogue box pops up, along with the message, "Item not in database, Choose one of the following options:" (e.g. Add a new person, new organization, etc.)  I have all the code for adding records to the database, I just need to get from the initial error message to the dialogue box.

Thanks

Thanks

0
Comment
Question by:jlnero
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 22749357
If you have a trappable error, then the attached tutorial will give you a step by step on how to trap the error and substitute your own custom error message.

                http://www.databasedev.co.uk/custom-error-message.html
0
 
LVL 1

Accepted Solution

by:
PIER117 earned 250 total points
ID: 22749408
Build a form that can be used as a pop up if no record is found.  The form should have your options to add a record and your message.

On both forms you'll need some code in your right after your search that is something along the lines of:

SQL = "SELECT blah blah...where blah blah equals my form field"
Set rsSearch = db.OpenRecordset(SQL)
If rsSearch.EOF then
    'open the form that handles adding records and displays your error message
    DoCmd.OpenForm "AddNewblahblah"
End if

Open in new window

0
 

Author Comment

by:jlnero
ID: 22749565
Thanks for the quick responses... both look helpful,, I'll give them a try. Probabably won't report back until late tomorrowl
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:jlnero
ID: 22754736
The procedure defined at
                http://www.databasedev.co.uk/custom-error-message.html
begins by displaying the error number using the following code:

Private Sub Form_Error(DataErr As Integer, Response As Integer)
    Debug.Print "DataErr = "; DataErr
End Sub

Where would I put the code in the attached snippet?
Private Sub Command1150_Click()
On Error GoTo Err_Command1150_Click
 
    Screen.PreviousControl.SetFocus
    DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
 
Exit_Command1150_Click:
    Exit Sub
 
Err_Command1150_Click:
    MsgBox Err.Description
    Resume Exit_Command1150_Click

Open in new window

0
 
LVL 38

Assisted Solution

by:puppydogbuddy
puppydogbuddy earned 250 total points
ID: 22755045
If you are referring to the Error Proc with the debug.print code line, it would go in the form's error event code, so that you can get the error number  of the error you want to supress.  That way you will be able to find out what error number to trap in the error handler of the procedure that generates that error.

In regards to your snippet, please provide more details....what are you trying to accomplish with the code in your snippet .....and what is your request to us regarding that snippet?
0
 

Author Comment

by:jlnero
ID: 22758195
Ok -- that clarifies it... ignore the snippet for now.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question