Can a QueryDef return the location of a record? 
Author Message
 Can a QueryDef return the location of a record?

Assume a Table contains 2 fields: Name and Phone. It appears that I can
create a QueryDef to return the Phone field, given a name, such as:

Parameter SelectName;
Select
    dbs.Phone,
From dbs
Where Name = SelectName;

But instead of returning a field, can I get the position of an item in
the querydef?

Thanks for all information,
G.Doucet



Fri, 06 Sep 2002 03:00:00 GMT  
 Can a QueryDef return the location of a record?

Quote:

> Assume a Table contains 2 fields: Name and Phone. It appears that I can
> create a QueryDef to return the Phone field, given a name, such as:
> Parameter SelectName;
> Select
>     dbs.Phone,
> From dbs
> Where Name = SelectName;
> But instead of returning a field, can I get the position of an item in
> the querydef?

If you mean by "position" something like a Bookmark or AbsolutePosition
property value meaningful in some other recordset, I'm afraid not. Maybe
there's a better way to accomplish what you're trying to do, if you'll
tell us more.

--

WARNING: I cannot be held responsible for the above        They're   coming  to
because  my cats have  apparently  learned to type.        take me away, ha ha!



Fri, 06 Sep 2002 03:00:00 GMT  
 Can a QueryDef return the location of a record?
I have a table with 20 records and a grid with 20 rows. The grid will not be bound;
actually I was thinking of using the msFlexGrid. The table will hold at least 2 fields: a
name and a group.I want the records on the grid in order of group, starting with the As,
then Bs then Cs and so on. Here is an example of my grid with 3 columns, Name, Group and
Result.
(row)    name    Group    Result
1        cat    A
2        dog    A
3        horse    A
4        ant    B
5        fly    B
I was thinking of doing a QueryDef with the OrderBy option to sort my data, and then fill
the grid. But then, depending on what the user does, I may want to flag the word 'dog' by
placing a word in the Result column of the row dog. But how can I know what row 'dog' will
end up in from the querydef. It seems as though I will need to store that information in
an array variable or something.

G.Doucet



Fri, 06 Sep 2002 03:00:00 GMT  
 Can a QueryDef return the location of a record?
You could use the FindFirst method, and snag the AbsolutePosition.
strSQL = "SELECT * FROM Table"
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
rs.MoveFirst
rs.FindFirst "Name = '" & SelectName & "'"
If Not rs.NoMatch Then
msgbox "Position: " & rs.AbsolutePosition
End If

Quote:

> Assume a Table contains 2 fields: Name and Phone. It appears that I
can
> create a QueryDef to return the Phone field, given a name, such as:

> Parameter SelectName;
> Select
> dbs.Phone,
> From dbs
> Where Name = SelectName;

> But instead of returning a field, can I get the position of an item in
> the querydef?

> Thanks for all information,
> G.Doucet

Sent via Deja.com http://www.deja.com/
Before you buy.


Sat, 07 Sep 2002 03:00:00 GMT  
 Can a QueryDef return the location of a record?

Quote:

> I have a table with 20 records and a grid with 20 rows. The grid will not be bound;
> actually I was thinking of using the msFlexGrid. The table will hold at least 2 fields: a
> name and a group.I want the records on the grid in order of group, starting with the As,
> then Bs then Cs and so on. Here is an example of my grid with 3 columns, Name, Group and
> Result.
> (row)    name    Group    Result
> 1        cat    A
> 2        dog    A
> 3        horse    A
> 4        ant    B
> 5        fly    B
> I was thinking of doing a QueryDef with the OrderBy option to sort my data, and then fill
> the grid. But then, depending on what the user does, I may want to flag the word 'dog' by
> placing a word in the Result column of the row dog. But how can I know what row 'dog' will
> end up in from the querydef. It seems as though I will need to store that information in
> an array variable or something.

If the rows in the recordset are in the same order as they end up in the
grid, the recordset's AbsolutePosition property will probably work well.

--

WARNING: I cannot be held responsible for the above        They're   coming  to
because  my cats have  apparently  learned to type.        take me away, ha ha!



Sat, 07 Sep 2002 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Function to Return QueryDef Property?

2. ADO SQL Search That Returns 0 Records When it Should Return 1

3. Combo click event returns 1st record not selected record

4. No data returned--Set Location

5. Returning location number from a list box

6. returning to location in grid after delete/add row

7. How to add new record to table in external location

8. record locking and cursor location

9. Why the concern over record location?

10. MCI Wav Recording - Set Buffer Size/Location?

11. How do I create a canned form?

12. Canned AcctReceivable Module needed!

 

 
Powered by phpBB® Forum Software