spacemonkey Posted October 15, 2006 Posted October 15, 2006 When a find is performed and no search data is entered into the find form and the user clicks on find button in my find layout the find script exits and the user is dropped out to a form layout that I don't want them to access. Has anyone come across this problem and, if so, how do I control this default action with my find script?
Raybaudi Posted October 15, 2006 Posted October 15, 2006 Hi sure you have to fix something on your script... Write it down !
LaRetta Posted October 15, 2006 Posted October 15, 2006 You need to trap for no records found yourself by turning on error capture, then control what happens, something like: Set Error Capture [ On ] Enter Find Mode [ pause ] Perform Find [ ] If [ not Get ( FoundCount ) ] Show Custom Dialog [ "No records found" ] Show All Records Go To Layout [ original layout ] Halt Script End If ... do whatever with found set
spacemonkey Posted October 15, 2006 Author Posted October 15, 2006 Thanks for your responses, guys. This is the script (- the code in [color:red]red is the bit that isn't working. What I'm trying to trap is the event where a user enters no search criteria and then clicks on the find button in my Find Layout) Allow User Abort [Off] Set Error Capture [On] Show/Hide Status Area [Lock; Hide] New Window [Name: "Find Material"; Height: 440; Width: 680; Top: 200; Left: 160] Go to Layout ["find_Material" (lib_Materials)] Go to Field [lib_Materials::mat_Brand] Enter Find Mode [Pause] Perform Find[] If [Get ( FoundCount ) = 0 [color:red]or Get ( LastError ) = "8"] Go to Layout ["find_noResults" (lib_Materials) Exit Script [] Else If [Get ( FoundCount ) > 1] Perform Script ["list_Materials"] Exit Script [] Else Perform Script ["details_Materials"] End If
spacemonkey Posted October 15, 2006 Author Posted October 15, 2006 Problem solved - I used the wrong error code! The relevant line should have read: If [Get ( FoundCount ) = 0 [color:red]or Get ( LastError ) = 400] Thanks for being out there, guys. It certainly helps to know there's someone on your side!
Recommended Posts
This topic is 6671 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now