469,159 Members | 1,482 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,159 developers. It's quick & easy.

dim null multiple fields...

1
I am using the function below to copy values in a field until it reaches the following a value that is <> null...it works fine(see vba below), however I need to accomplish a similar task to copy the next record from a different field and then paste it into the null values. Please assist!

EX: I want the null value in "FIELD TWO" to equal 3 from "FIELD ONE" and the second null from "FIELD TWO" to equal 5 etc.

FIELD ONE FIELD TWO
1 7
2
3 8
4
5 10


Function monkeythought()
Dim u As String

Set Mydb = CurrentDb()
Set Myds = Mydb.OpenRecordset("Number")
Myds.MoveFirst
Do While Not Myds.EOF
Myds.Edit
For Each myfld In Myds.Fields
If myfld.Name = "one" Then
If Myds(myfld.Name).Value <> "" Then
u = Myds(myfld.Name).Value
Else
Myds(myfld.Name).Value = u
Myds.Update
End If
End If

Next myfld

Myds.MoveNext
Loop

End Function
Jun 14 '07 #1
0 809

Post your reply

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

Similar topics

26 posts views Thread by Agoston Bejo | last post: by
5 posts views Thread by David Sworder | last post: by
6 posts views Thread by john | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.