Solved

Customizing Menu Items in MS Access 2003

Posted on 2008-10-18
6
292 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
  • 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now