This is very easy for me. In my Oracle and local tables, my PK field is always named KeyID and is always integer [in Oracle, it is NUMBER(8)]
>Mark,
>
>I have seen query forms like that. My only worry is that they are intimidating to the user (i.e. too many choices). Perhaps I can take that idea and try to simplify it. I'm sure that I only want to search on one criteria at a time, so the SQL generation should be pretty simple.
>
>Do you include the PK field name in a property or do you have a generic way to id what the PK field is?
>
>Thanks
>
>John
>
>>For the very reason that I do not want to manage parameterized views for every conceivable way a user wants to do a search on remote data, I use SPT for this.
>>
>>I have a query form with textboxes for various [important] fields where the user indicates what fields they want to search and the values each field should match. I then create the SQL in a GenerateSQL form method which includes the retrieval of the PK. I then use SQLExec() to run the search and return the results to a cursor which populates a grid. The user then selects the record they want. At this point, I use the PK in a parameterized view to retrieve that record for editing.
>>
>>On the query form, I display the generated SQL in an edit box and allow them to edit the WHERE clause only. [Only the Where clause is in the edit box I have plain text boxes before and after to display the rest of the SQL. I also have an option group where they can indicate whether to use the LIKE operator or look for exact matches. In my GenerateSQL method, I generate the string using LIKE first. Once the string is complete, I do a STRTRAN() on LIKE and replace with equal sign if that is what is indicated by the option group value.
>>
Mark McCasland
Midlothian, TX USA