Update Command (1 Viewer)

GBeck

Registered User.
Local time
Yesterday, 21:36
Joined
Jan 31, 2006
Messages
12
I have searched and am unable to find the solution, so if it's posted already, I am sorry.
but the problem is that I am trying to use a cmd button on one form to only open certain records from the main form. No problem, except on the main form I have another cmd button that updates from one field to another. What I am trying to accomplish is when I hit the first cmd button to open my main form with the filters on and automatically run the update cmd.
I have already tried putting in the update code that works otherwise works fine, just can't seem to get it to update on it's own.
thanks for any help.
 

GBeck

Registered User.
Local time
Yesterday, 21:36
Joined
Jan 31, 2006
Messages
12
this might help to explain the problem a bit better. on the main form with all the records, I have a command button the runs this code:
Private Sub cmdUpdate_Click()
If [STATUS4] <> "" Then
[STATUS5] = [STATUS4]
[STATUS-DT5] = [STATUS-DT4]

End If
If [STATUS3] <> "" Then
[STATUS4] = [STATUS3]
[STATUS-DT4] = [STATUS-DT3]
End If
If [STATUS2] <> "" Then
[STATUS3] = [STATUS2]
[STATUS-DT3] = [STATUS-DT2]
End If
[STATUS2] = [STATUS]
[STATUS-DT2] = [STATUS-DT]
Me.Refresh
End Sub

what I am trying to accomplish is on a differnent form click a button that will run my macro to open the form with my filter then run the above command.

Hope that helps
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 21:36
Joined
Feb 19, 2002
Messages
43,774
Forms are intended to be used interactively. You are trying to use a form to perform a batch process. The proper technique would be to run an update query or to use a DAO .update loop to update each record.

BTW, your real problem is a design issue. You have a repeating group that you have flattened. Since there are multiple status', each should be stored in a spearate record. That would eliminate the need for this code entirely since adding a new status would automatically "push down" the older status'.
 

Users who are viewing this thread

Top Bottom