>Hi,
>
>is it advisable that everytime you choose a specific item in a combobox, it will trigger a command that will create a sql remote view?
>
>The idea is that a pageframe that has 2 pages each contains a grid.
>
>everytime the user clicks item A, the active page is set to 1. If the use clicks on item B in the combobox, a filter form will pop up. The user will encode or select his/her desired filter conditions and upon clicking the ok button, the program will then activate page 2 of the pageframe and will proceed in creating SQL remote view named(dispatches) depending on the filter conditions the user selected?.
>
>Note: The grid in page2 has a recordsourcetype = alias and recordsource = dispatches
>
>
>Thanks in advance...
Mike,
What you say is doable. However views are part of a DBC, each new view would require a new unique name and probably you would drop after usage. Remote view's initial loading is slower and if you would change it per click it might be too much time consuming (once loaded however they might be faster depending on backend and version).
If you can't use one parametric view from the beginning and grid needs no update (though this could be made updatable too) there is a simplier way. Use SQL pass through cursors or ADO recordsets with Activex grids. ie: lcStatement is prepared by user selections and look like :
lcStatement = 'select * from pubs..titles where ...'
lnHandle=SQLStringConnect('DRIVER=SQL Server;SERVER=servername;DATABASE=pubs;UID=name;PWD=***')
with thisform.myPgf.myPage.myGrid
.RecordSource = ''
SQLExec(lnHandle,lcStatement,'myCursor')
.RecordSource = 'myCursor'
endwith
SQLDisconnect(lnHandle)
You might make the connection and keep handle alive depending on your needs.
Cetin