L
Lee-Anne
Sorry I'm going to post this again as my original post is
now on the 2nd page and I'm afraid this might be missed.
I'm also posting again as I failed to state that I had
exhausted all resources including the Helpdesk function
and any books I have access to...
I have written code that updates a record in one table
(Table 1) with information from another table (Table 2),
if the record meets a certain condition i.e. If (Forms!
[Table1]![Defect ID] = Forms![Table2]![Helpdesk Ref]) And
(Forms![Table2]![DateCommentAdded] = Date) Then ... My
problem is that while the code works for the first record,
I don't know how to get it to cycle/loop through all
records in both tables until it reaches the end of Table
2. At the same time, if condition (Forms![Table1]![Defect
ID] = Forms![Table2]![Helpdesk Ref])is false I want move
to the next record for Table 1 only and for this to
continue until the condition is true.
Using the example/info provide by the Help facility I
produced the following code which doesn't work - it still
only updates the first record. If
someone could tell me where I've gone wrong that would be
most helpful:
Set dbSystemAdmin = CurrentDb
Set rsHelpdesk = dbSystemAdmin.OpenRecordset("Helpdesk")
Set rsProbMan = dbSystemAdmin.OpenRecordset("Problem
Management")
rsProbMan.MoveFirst
rsHelpdesk.MoveFirst
Do
If (Forms![Helpdesk1]![Defect ID] = Forms![Problem
Management]![Helpdesk Ref]) Then
Forms![Helpdesk1]![NewProbManUpdate] = False
UpdateTransfer = Forms![Helpdesk1]![RecentUpdate] &
Forms![Helpdesk1]![Updates]
Forms![Helpdesk1]![Updates] = UpdateTransfer
Forms![Helpdesk1]![RecentUpdate] = Forms![Problem
Management]![Recent Update]
Forms![Helpdesk1]![NewProbManUpdate] = True
rsProbMan.MoveNext
Else
rsHelpdesk.MoveNext
End If
Loop Until rsProbMan.EOF
now on the 2nd page and I'm afraid this might be missed.
I'm also posting again as I failed to state that I had
exhausted all resources including the Helpdesk function
and any books I have access to...
I have written code that updates a record in one table
(Table 1) with information from another table (Table 2),
if the record meets a certain condition i.e. If (Forms!
[Table1]![Defect ID] = Forms![Table2]![Helpdesk Ref]) And
(Forms![Table2]![DateCommentAdded] = Date) Then ... My
problem is that while the code works for the first record,
I don't know how to get it to cycle/loop through all
records in both tables until it reaches the end of Table
2. At the same time, if condition (Forms![Table1]![Defect
ID] = Forms![Table2]![Helpdesk Ref])is false I want move
to the next record for Table 1 only and for this to
continue until the condition is true.
Using the example/info provide by the Help facility I
produced the following code which doesn't work - it still
only updates the first record. If
someone could tell me where I've gone wrong that would be
most helpful:
Set dbSystemAdmin = CurrentDb
Set rsHelpdesk = dbSystemAdmin.OpenRecordset("Helpdesk")
Set rsProbMan = dbSystemAdmin.OpenRecordset("Problem
Management")
rsProbMan.MoveFirst
rsHelpdesk.MoveFirst
Do
If (Forms![Helpdesk1]![Defect ID] = Forms![Problem
Management]![Helpdesk Ref]) Then
Forms![Helpdesk1]![NewProbManUpdate] = False
UpdateTransfer = Forms![Helpdesk1]![RecentUpdate] &
Forms![Helpdesk1]![Updates]
Forms![Helpdesk1]![Updates] = UpdateTransfer
Forms![Helpdesk1]![RecentUpdate] = Forms![Problem
Management]![Recent Update]
Forms![Helpdesk1]![NewProbManUpdate] = True
rsProbMan.MoveNext
Else
rsHelpdesk.MoveNext
End If
Loop Until rsProbMan.EOF