Smart questions
Smart answers
Smart people
Join Tek-Tips Forums
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Locate record in form with value in field of another form

caosity (TechnicalUser) (OP)
21 Oct 09 12:18
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.
kimenemark (Programmer)
21 Oct 09 18:38

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)
 
kimenemark (Programmer)
21 Oct 09 18:55
Sorry... the filter schould be set up as follows:

CODE

dyn["SS_#"] = "=\""+SSN+"\""
 
caosity (TechnicalUser) (OP)
22 Oct 09 9:11
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.
caosity (TechnicalUser) (OP)
22 Oct 09 10:34
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?
kimenemark (Programmer)
22 Oct 09 15:54
Thats quite simple ;)

CODE

if frm.SS#.locate("SS#",SSN) then
    ; do your thing
else
    msgInfo("Title","Message")
endif
caosity (TechnicalUser) (OP)
29 Oct 09 19:10
Awesome. Thank you very much.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close