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

Replace Null field with previous record value

P: 6
I get a text file every day that has Customer ID and Product ID. The customer ID is only in the first record. I need to replicate the customer ID into each field relating to his products. Find and replace box works fine but I have hundreds to do each day. I need a to do it in the code area on "on open" or some other automatic way.
Please help me with my near vission.
Thanks,
Craig
Jun 10 '06 #1
Share this Question
Share on Google+
3 Replies


Banfa
Expert Mod 5K+
P: 8,916
Erm you haven't mentioned what packages/programs you are using/you have available or what operating system you are using.
Jun 11 '06 #2

P: 6
Erm you haven't mentioned what packages/programs you are using/you have available or what operating system you are using.
I use access XP on windows xp home. The file that comes to me is a .csv. I have it linked to my database and append to a table that requires the customer ID filled in - it's the index for the product ID.

Hope that is the info you were asking for.

Thanks,

Craig
Jun 12 '06 #3

P: 6
Banfa,
Thanks For responding

Just got the answer. Tested it and works great.

Dim rstThis as RecordSet
Dim varField2 as Variant

Set rstThis = CurrentDB.OpenRecordset("11-SWBACKORDS-test") ' or whatever it is called

With rstThis
.MoveLast
.MoveFirst
If .RecordCount Then
Do Until .EOF
If Len(nz(!Field2, vbNullString)) Then
varField2 = !Field2
Else
.Edit
!Field2 = varField2
.Update
End If
.MoveNext
Loop
End If
.Close
End With
Set rstThis = Nothing

Thanks again,

Craig
Jun 12 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.