The next column returns the value of a dialogue list box that returns one of 5 Business Units (BU).
The following columns just return lots of data from number fields on the form.
I want to be able to pull off all the data for a particular Business Unit for a quarter. I understand that the best way to do this is to create a DBLookup that looks for the correct key that needs to be in the first column of my lookup view.
I’m struggling to work out how this “key” should be coded as I’m guessing that I need to concatenate some columns?
Any advise on the best way forward would be really appreciated.
Opps I spoke too soon. The look up view works fine and returns the correct documents. However it’s with the actual DBLookup in the field in a form that I’m struggling with. I can’t figure out the exact code that I need to use as the key. I’ve tried to replicate the same code as in my View Look up but that fails (incorrect data type).
I’ve tried to use the code below as my key but it fails (incorrect datatype):-
@Sum(@DbLookup(“”;“”:“”;“LUQ”;@If(@Month(Month) <=3;"Fiscal Year " + @Text(@Year(Month)-1);"Fiscal Year " + @Text(@Year(Month))) + M1 := @Month(Month);
@Sum(@DbLookup(“”;“”:“”;“LUQ”;@If(@Month(Month) <=3;"Fiscal Year " + @Text(@Year(Month)-1);"Fiscal Year " + @Text(@Year(Month))) + M1 := @Month(Month);
at the very end you use the assignment operator “:=” on the right side of a formula. Is this intentional? I would think you can only put variables or fields on the left side of the assignment operator.
Hi Cesar,that part of my code determines which month should fall into which quarter in my lookup view. If I lose that part then the correct selection is not made. My problem is that I can’t work out how to describe/code the actual key in my lookup field on the form.
I am aware that my DBLookup code in my form field has to use the same key as in my lookup view and that’s where my problem seems to be.
My suggestion is not to work in one long line of code. I am certain that your intention was not to use an assignment operator within the @DbLookup. Here is what you had (after breaking up the long line into manageable pieces):
Thanks for you help Guys. Thank god it’s Friday is all I can say. I’ll give your suggestions a go and see what happens. Your help is appreciated.Regards
Hi Guys, firstly thanks for all your help last week. I have decided to make the DBLookup as simple as possible. I now only require the DBLookup key to be :-
Ok ok so I’m a coward and I’ve given up trying to find the key. I’ve decided to put a couple of hidden computed for display fields on the form that return the fiscal year and the Quarter. In my lookup view I have concatenated the field names together with the BU field (FYear + QYear + BU). This then forms my Key in my DBLookup code.
Probably not the best or the most dynamic way to do it but it seems to work ok.
Hi Cesar,I did try the method that you suggested but unfortunately that didn’t work for me either as it kept returning error messages. I decided to use some hidden fields instead as I needed to finish off some views quickly for my users.
Please don’t think that I ignored your advice or didn’t appreciate it, as I found it extremely helpful. When I’m under less pressure I will revisit this problem and try to solve it. Once again many many thanks for your help.