I was chastised pretty severly the last time I tried this , so here I go again!
I have a form that I want to use to change the status of clients from "open" to "closed" called frmcloseout. The status is being generated from a combobox in the client profile table which has the fields clientid (pk), lastname, firstname, status, opendate, and closeddate. When a client is first entered into the database, he or she goes in as "open" and only the opendate is filled in. From there, the user can see the client's information from a profile form. On the profile form, there is a button called closeout that opens frmcloseout that should change the client's status and thus close out the client's account.
This is the code that I copied from the code page for the closeout button (I just used the button wizard to do it):
Private Sub closeout_Click()
On Error GoTo Err_closeout_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmcloseout"
stLinkCriteria = "[clientid]=" & Me![clientid]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_closeout_Click:
Exit Sub
Err_closeout_Click:
MsgBox Err.Description
Resume Exit_closeout_Click
End Sub
What can I insert in there to 1) Upon opening the document, automatically change the client's status from "open" to "closed" and 2) fill in the empty closeddate field with the default date of Now() while still allowing for a person to edit the close out date in case they are entering the information at a later date?
I have a form that I want to use to change the status of clients from "open" to "closed" called frmcloseout. The status is being generated from a combobox in the client profile table which has the fields clientid (pk), lastname, firstname, status, opendate, and closeddate. When a client is first entered into the database, he or she goes in as "open" and only the opendate is filled in. From there, the user can see the client's information from a profile form. On the profile form, there is a button called closeout that opens frmcloseout that should change the client's status and thus close out the client's account.
This is the code that I copied from the code page for the closeout button (I just used the button wizard to do it):
Private Sub closeout_Click()
On Error GoTo Err_closeout_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmcloseout"
stLinkCriteria = "[clientid]=" & Me![clientid]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_closeout_Click:
Exit Sub
Err_closeout_Click:
MsgBox Err.Description
Resume Exit_closeout_Click
End Sub
What can I insert in there to 1) Upon opening the document, automatically change the client's status from "open" to "closed" and 2) fill in the empty closeddate field with the default date of Now() while still allowing for a person to edit the close out date in case they are entering the information at a later date?
Last edited: