Hello,
I have attached a sample app which i try to get working.
I have a form with a subform on it. I want the user to enter a number to search for and push the search button.
If that number exists in the database the subform is shown and the user should be able to update the record.
If the number is not found he gets an error message.
I managed to get it running but i think i fire a query event two times ?
The following is the code i use in the onpush event:
I also want to check on the status field of the found record before showing it to the user but i dont know how to do this?
I have put some comments in the app to explain better what i mean....
thank you for your experienced help !
Olivier
I have attached a sample app which i try to get working.
I have a form with a subform on it. I want the user to enter a number to search for and push the search button.
If that number exists in the database the subform is shown and the user should be able to update the record.
If the number is not found he gets an error message.
I managed to get it running but i think i fire a query event two times ?
The following is the code i use in the onpush event:
Code:
dim tbl as P dim Q as P dim nrecs as N dim vGreffeuniek as C if searchnumber <> "" then ' If number to search on is filled in vNumber = trim(searchnumber) tbl = table.current() query.description = "" query.order = "" query.filter = "Number = " + vNumber query.options = "" Q = tbl.query_create() nrecs = Q.records_get() if nrecs = 0 Q.drop() ui_msg_box("Error","Number "+trim(str(searchnumber))+" not found !") searchfield.activate() end end if ' if record is found then i want to check on the state ' if state is "V" or "G" then a messagebox should appear saying status is not OK ' if state is "Q" or "K" then the record should be shown in the subform and the user should be able to edit it ' Searchform.QueryRun("Number = " + vNumber) ' This command shows the correct record but this way the query is executed two times ?? Subform1.show() else ui_beep(UI_EXCLAMATION_BEEP) searchfield.activate() end if
I have put some comments in the app to explain better what i mean....
thank you for your experienced help !
Olivier
Comment