Solved

Customizing Menu Items in MS Access 2003

Posted on 2008-10-18
6
297 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

770 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