Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locate record in form with value in field of another form

Status
Not open for further replies.

caosity

Technical User
Sep 10, 2009
13
US
Ok, I know this is simple, I just don't know what I am doing wrong or missing. I am using paradox 5. To simplify matters, I am using 1 table and 2 forms, x and y. Form x displays the social security number, last name, first name, and middle name of a client. Form y displays the same and additional information contained in the table. I have a push button on Form x that I want to look up the information contained in Form y for the same person, using the ssn. The code I am using is below, but when I push the button, Form y opens defaulting to the first person in the table and I get an error triggered by a locate operation.

method pushButton(var eventInfo Event)
var
frm form
SSN string
endVar

SSN=SS_#.value

if isedit() then endedit() endif
frm.open("y.fsl")
frm.locate("SS_#",SSN)
endmethod

Please help.
 
Code:
frm.SS_#.locate("SS_#",SSN)

But the user would still be able to remove focus from the record you present.

You could also set a filter to keep focus on the selected record!

Code:
var
    dyn    DynArray[] String
endvar

dyn["SS_#"] = SSN
frm.SS_#.setGenFilter(dyn)
 
Sorry... the filter schould be set up as follows:

Code:
dyn["SS_#"] = "=\""+SSN+"\""
 
The frm.SS_#.locate("SS_#",SSN)almost worked, but I got an error message that there wasn't a field called "SS_#" in my table, which since in quotes I was able to leave out the "_" and it worked. I don't mind them changing the preference to another record in the table, but now the button works.

Thank you very much.
 
Could you also help me with some code that if the person is not found in the second table, now I have other tables involved, that it gives a custom error message?
 
Thats quite simple ;)

Code:
if frm.SS#.locate("SS#",SSN) then
    ; do your thing
else
    msgInfo("Title","Message")
endif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top