October 15, 200619 yr 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?
October 15, 200619 yr 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
October 15, 200619 yr Author 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
October 15, 200619 yr Author 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!
Create an account or sign in to comment