By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,285 Members | 1,687 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,285 IT Pros & Developers. It's quick & easy.

Update from a Recordset (I think)

P: n/a
Hello,

My table is like this:

Name Date DateDiff
1 Bob 12/05/03
2 Paul 01/01/01
3 Bob 24/05/03
Initially, the DateDiff column is empty. What I need (and ask for help
on) is to search for the first Bob, search for the second Bob, then
update the first Bob with the difference in Date between first found
record and second. (Well done if you have got this far!)

I have opened a recordset and can get to the first Bob. The trouble I
have is then selecting the next Bob. (And there may be more Bobs).

Please can someone help get me on the correct path? I am thinking two
recordsets (??) but not sure how to identify the previous Bob
properly.

Tia for any help.

Cheers.

J
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Perhaps

SELECT Max(Date) - Min(Date) FROM MyTable WHERE Name = 'Bob'

will do the trick?
Pavel

jah_aaa wrote:

Hello,

My table is like this:

Name Date DateDiff
1 Bob 12/05/03
2 Paul 01/01/01
3 Bob 24/05/03

Initially, the DateDiff column is empty. What I need (and ask for help
on) is to search for the first Bob, search for the second Bob, then
update the first Bob with the difference in Date between first found
record and second. (Well done if you have got this far!)

I have opened a recordset and can get to the first Bob. The trouble I
have is then selecting the next Bob. (And there may be more Bobs).

Please can someone help get me on the correct path? I am thinking two
recordsets (??) but not sure how to identify the previous Bob
properly.

Tia for any help.

Cheers.

J

Nov 12 '05 #2

P: n/a
cheers Pavel,

But what if there are 3 Bobs? This will not work then.

Pavel Romashkin <pa*************@hotmail.com> wrote in message news:<40***************@hotmail.com>...
Perhaps

SELECT Max(Date) - Min(Date) FROM MyTable WHERE Name = 'Bob'

will do the trick?
Pavel

jah_aaa wrote:

Hello,

My table is like this:

Name Date DateDiff
1 Bob 12/05/03
2 Paul 01/01/01
3 Bob 24/05/03

Initially, the DateDiff column is empty. What I need (and ask for help
on) is to search for the first Bob, search for the second Bob, then
update the first Bob with the difference in Date between first found
record and second. (Well done if you have got this far!)

I have opened a recordset and can get to the first Bob. The trouble I
have is then selecting the next Bob. (And there may be more Bobs).

Please can someone help get me on the correct path? I am thinking two
recordsets (??) but not sure how to identify the previous Bob
properly.

Tia for any help.

Cheers.

J

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.