Im trying to get those data in the database(access) update to the new date but the problem was it was not updated for all but only the first one. Please help me!...is it something problem with While Not Wend??
If rstData4("SpecID") = SpecId Then
ReviewDate3 = UCase$(Trim$(NullReturn(rstData4("SpecLastUpdate"), "")))
ReviewDate3 = rstData4("SpecLastUpdate")
ReviewDate4 = DateAdd("m", 60, ReviewDate3)
EffectiveDate2 = ReviewDate4
GoTo FoundSpec
Else
rstData4.MoveNext
End If
Wend
okey, I have rstData3 and rstData4 which are the databases in access. Those databases have same specid and title and i compared in order to get the date(speclastupdate) that only have in rstData4.
SpecId = rstDate3
ReviewDate3 = the name for speclastupdate in rstData4
ReviewData4 = new date after dateadd
EffectiveDate2 = date displayed in output attached (EFFECTIVE_DATE)
Hope these information will good enough for u to help me to figure out what was the problem? please..
I'm not even sure what you are asking. There is no code shown that does an update so nothing would be updated by what is given.
Your while loop will find the first match then jump out of the loop via the goto. If you want to retrieve more than one then you need to do something different.
As a general rule you should avoid usig Goto, I see you have used it several times which makes for very sloppy code and there really is no need to use them. A properly structured If statement will eliminate the need for those in most cases.
As for getting the updated data rather than looping through all the records you should be selecting the records you want from the database so that your resulting recordset contains only those records you want.
masyus, in your code there are at least 2 similar While Not rstData4.EOF loops. They both have a Goto FoundSpec command, but there is only one label named FoundSpec, and for the second loop this lies within a different If statement. I wonder why you are not getting a compiler error with that one. You may not jump into an If clause from another If clauses code.
You should try to structure your task in a more logical way and really try to avoid Gotos.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.