PDA

View Full Version : Code Help


ABC123

Mark Williams
02-20-2007, 06:05 AM
I have the following code attached to a button on a form. It works with version 7 but gives the attached error under version 8.

Anyone suggest how to change it to make v8 like it?

Thanks



'Date Created: 13-Jan-2004 07:11:25 PM
'Last Updated: 14-Jan-2004 06:46:59 AM
'Created By :
'Updated By :
inv_fnd = ui_get_text("ENTER INVOICE NUMBER","Enter the invoice number to find...")
IF inv_fnd = ""
END
END IF
inv_fnd = padl(inv_fnd,8,"0")
'parentform.index_setexplicit("<Invoice_No>")
parentform.find(inv_fnd)

G Gabriel
02-20-2007, 06:18 AM
try:
dim inv_fnd as c 'at the top of the code

Tom Cone Jr
02-20-2007, 06:41 AM
Mark,

1) are the form's records sorted on the invoice number field when the script runs?

2) in your table structure is the invoice number numeric or character (data type) ?

Mark Williams
02-20-2007, 08:01 AM
try:
dim inv_fnd as c 'at the top of the code

This didn't work - thanks

Mark Williams
02-20-2007, 08:06 AM
Mark,

1) are the form's records sorted on the invoice number field when the script runs?

2) in your table structure is the invoice number numeric or character (data type) ?

The form is sorted by the invoice field and it is defined as a character field.

If it matters, the invoice number field is displayed via an embedded browse.

Thanks

Tom Cone Jr
02-20-2007, 08:46 AM
Mark, is the form based on a set of tables? Does the embedded browse display records from the parent table or from a child table? -- tom

Mark Williams
02-20-2007, 10:02 AM
Mark, is the form based on a set of tables? Does the embedded browse display records from the parent table or from a child table? -- tom

The form is based on a set and the embedded browse displays records from the parent table.
Thanks

Tom Cone Jr
02-20-2007, 10:05 AM
Mark,

I don't see anything else to suggest other than to upload a copy of the database with instructions for us to follow to see the problem. With a bit of study perhaps we can explain what's happening... or, in worst case, we could confirm a bug to be submitted to Alpha.

Mark Williams
02-20-2007, 10:27 AM
Mark,

I don't see anything else to suggest other than to upload a copy of the database with instructions for us to follow to see the problem. With a bit of study perhaps we can explain what's happening... or, in worst case, we could confirm a bug to be submitted to Alpha.

I just made an interesting discovery. If I open the form from the control panel, the button works fine. If I open the form from the Main Menu, the button gives the above error.

Does that give any other indication of what might be wrong with it?

Thanks

Mark Williams
02-20-2007, 10:47 AM
Ok - I figured it out - and as always, it was my fault.

In the form properties, I have it set to filter records to only show:
Invoice_No>"00015000"

The button on the main menu was also set to use the same filter when opening the above form. I removed this from the button on the main menu and it works fine.

I appreciate all the help.

G Gabriel
02-20-2007, 02:44 PM
Mark:
Although you say you solved the problem and it was your fault, I am not so convinced. I think you are being hard on yourself.

I tried a simillar script on a test form with the same error message that does not make any sense! Furthermore, the filter should not matter. If parentform.find() cannot locate the exact match, it will locate the closest one. So, most likely the filter is not the issue.

If it re-appears, I would report it as a bug. I believe alpha is not recognizing the variable in the first execution and whatever you did, although might have nothing to do with that, only worked as the variable with it's scope & definition became availble on subsequent executions which might have led you to believe that whatever you did has fixed the issue.

I hope, for you sake, I am wrong, but none of these make any sense.