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
Solved

Customizing Menu Items in MS Access 2003

Posted on 2008-10-18
6
298 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
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
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…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

856 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