Normal Topic xlookup (Read 940 times)
NICEBERG
Full Member
Members
***
Offline


I came, I saw, I'm still
trying to figure it out!

Posts: 208
Location: Green Bay, WI
Joined: Dec 17th, 2003
xlookup
Dec 17th, 2005 at 3:09pm
Print Post Print Post  
I modified this from an earlier message, since I resolved the problem of the extra digit in the LE name. Current issure:

One application, two forms named Cost and Orders. LEs on Cost include: Rec_No; Cost2; Qty0 and Description.
LEs on Orders include: Rec_No0 and Total_Cost. The form, Cost, is displayed as a spreadsheet on a tab of Orders. Programming:

If Description = "Labor" then begin

Qty0 = "1"

(I know the following should be conditional, but I'm just trying to get it to work)
XLookup(@FN,Rec_No,"Orders!Rec_No0","Orders!Total_Cost",Cost2)    --(I tried this without the second Orders! before Total_Cost)

If @error then @Msgbox("Sorry","","")

Goto Qty0

end

I have verified that the fields are bound to the same type of elements (numbers, money). I through the @error in just to check what was going on. Oddly, the above statement, or something very similar, worked once. Can't get it to function now. Any help??
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: xlookup
Reply #1 - Dec 17th, 2005 at 3:20pm
Print Post Print Post  
First make sure you are NOT testing this in Preview Mode, since "x" commands only work in runtime.

I believe your problem may be that you are including the form name in two places. You should only need it in the first place that you have it. Try this and let me know if it works.
Code
Select All
XLookup(@FN,Rec_No,"Orders!Rec_No0","Total_Cost",Cost2) 


  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
NICEBERG
Full Member
Members
***
Offline


I came, I saw, I'm still
trying to figure it out!

Posts: 208
Location: Green Bay, WI
Joined: Dec 17th, 2003
Re: xlookup
Reply #2 - Dec 17th, 2005 at 3:50pm
Print Post Print Post  
I have been trying this in runtime. I also have tried it without the duplicate form name. I'm going through all the other code trying to see if something else is causing the glitch. Thanks for verifying that part of the code at least.
  
Back to top
 
IP Logged
 
NICEBERG
Full Member
Members
***
Offline


I came, I saw, I'm still
trying to figure it out!

Posts: 208
Location: Green Bay, WI
Joined: Dec 17th, 2003
Re: xlookup
Reply #3 - Dec 17th, 2005 at 4:17pm
Print Post Print Post  
Now this is just plain weird. Okay, I can add a record to my Orders form but when I get down to the tab with the Cost form the XLU doesn't function. I can, however, save the record, retrieve it, go to the Cost form on the tab, tab through the Description element, which reads "Labor" and the XLU works.

So then I went to the full page form for Cost, in the add mode, and entered the data there. It kind of works. "Kind of" meaning that I will get the expected number from Total_Cost, but it is preceded by a semicolon - ;240.00 vs $240.00. I've verified the formatting. THEN, when I tab into the Cost2 field the formatting changes to the desired result. And THEN when I tab OUT of the field, it reverts to the semicolon.

(Exits scratching head and to dive deeper....)
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: xlookup
Reply #4 - Dec 17th, 2005 at 4:44pm
Print Post Print Post  
Quote:
I also have tried it without the duplicate form name.

I'm sorry, now I see that you left a note already stating that, in your first post. I don't know how I overlooked it. Embarrassed

Quote:
Okay, I can add a record to my Orders form but when I get down to the tab with the Cost form the XLU doesn't function. I can, however, save the record, retrieve it, go to the Cost form on the tab, tab through the Description element, which reads "Labor" and the XLU works.

This may be because the subrecords are not saved until you save the parent record, or specifically save the subrecord. You would have to save the subrecord before the xlookup will work correctly.

Can you use @FormFieldValue rather than xlookup? It seems to work even if the subrecord has not yet been saved to disk.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
NICEBERG
Full Member
Members
***
Offline


I came, I saw, I'm still
trying to figure it out!

Posts: 208
Location: Green Bay, WI
Joined: Dec 17th, 2003
Re: xlookup
Reply #5 - Dec 17th, 2005 at 4:54pm
Print Post Print Post  
That's new territory for me, but I'll give it a try. Thanks for the tip!
  
Back to top
 
IP Logged
 
NICEBERG
Full Member
Members
***
Offline


I came, I saw, I'm still
trying to figure it out!

Posts: 208
Location: Green Bay, WI
Joined: Dec 17th, 2003
Re: xlookup
Reply #6 - Dec 17th, 2005 at 5:15pm
Print Post Print Post  
Thank you Carl!!! ummm, why didn't you tell me this at 5:00 this morning when I started banging my head against the wall with this "thing"???  Tongue Nice to learn another new trick.  8)
  
Back to top
 
IP Logged