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

How to do this??

P: n/a
Roy
Hello,
I have a A2K application.I import a .csv file into my database
everyday.The .csv file has one column ,comments,which has merged
cell.Thus in the access table it is as follows:

ProbID Comments
1011 12/12/2004.The first time failure
12/13/2004.The second instance.
12/13/2004. the problem got resolved.

1012 12/13/2004.data transfers erratic.
12/14/2004.Engineer scheduled for visit.

For the purpose of my application.i need to have the table look like,
ProbID Comments
1011 12/12/2004.The first time failure
1011 12/13/2004.The second instance
1011 12/13/2004.the problem got resolved.

1012 12/13/2004.data transfers erratic.
1012 12/14/2004.Engineer scheduled for visit.

How to copy the ProbID to the rows below the first occurence through a
vba code or query?Any suggestions?

Thanks much

Roy

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


P: n/a
Assuming the order of the records is as above
something like

Sub UpdateIt

Dim rst as DAO.Recordset
Dim lngLastProbID as long

Set rst = DBEngine(0)(0).Openrecordset("MyTable",dbopendynas et)

rst.movefirst
lngLastProbID = rst!ProbId

Do until rst.Eof

If isnull(rst!ProbID) then
With rst
.Edit
!ProbID = lngLastProbID
.Update
End with
Else
lngLastProbID = rst!ProbID
End if

rst.MoveNext
Loop

End sub

Nov 13 '05 #2

P: n/a
Roy
Tony,
Thanks much.It worked great!

Roy

Tony Miller wrote:
Assuming the order of the records is as above
something like

Sub UpdateIt

Dim rst as DAO.Recordset
Dim lngLastProbID as long

Set rst = DBEngine(0)(0).Openrecordset("MyTable",dbopendynas et)

rst.movefirst
lngLastProbID = rst!ProbId

Do until rst.Eof

If isnull(rst!ProbID) then
With rst
.Edit
!ProbID = lngLastProbID
.Update
End with
Else
lngLastProbID = rst!ProbID
End if

rst.MoveNext
Loop

End sub


Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.