Subject Re: Databuttons not visible on compiled form
From Mervyn Bick <invalid@invalid.invalid>
Date Mon, 25 Apr 2016 21:23:37 +0200
Newsgroups dbase.getting-started

On 25/04/2016 18:36, Rich Gent wrote:
> I built a form to enter information for new items in a inventory file. Used push buttons from the standard menu, they worked fine, added buttons from databuttons.cc (first, last, next, previous). They show up on the form during design but not when form is run. Push buttons from the standard tab on the component pallet do work.
>
> Also having problem filtering records for this form. Tried sgl=select * from invdb1 where start_date=date()) didn't work. I can create a memory variable CurDate=date() and set it as the rowset filter and that works. I can open the dbf  from the command line and set filter to date() then browse and that works. Would really like to do it from the sql.
>

The toolbars from custbuttons.cc do not show when the form is run if
they can't find the form's rowset.

If the line assigning a rowset to the form's rowset property

      this.rowset = this.queryname1.rowset

is missing or is not immediately after the constructor code for all the
objects and before the functions then the rowset is not assigned.  Check
that this line is present and that it is in the correct position.

The toolbars from the dUFLP display if the rowset is not assigned to the
form's rowset property but, of course, they don't work.  Standard
pushbuttons work because you execute the actual rowset's next() method
in the onClick event handler.

date() is a dBASE function and it is not recognised by localSQL.  This
means you can't use it in a SQL select statement. There are ways of
including a literal date in a SQL select statement but the easiest way
is to use a parameter driven query.   You can use date() to assign
today's date to the parameter.  A parameter in a Sql statement is
indicated by a colon.

     .....
     sql = 'select * from invdb1 where start_date = :sdate'
     params['sdate'] = date()
     .....

In most cases dBASE is not case sensitive but here the parameter in the
SQL statement and the parameter assignment must match exactly.

You can assign a different date to the parameter and then requery() the
query if you need to select records for a different day.

Mervyn.