Change record with a button

kbrooks

Still learning
Local time
Today, 15:55
Joined
May 15, 2001
Messages
202
I have a field called "Status" in a call log that defaults to "Open" when you first enter the call. I have another form that is used to close the form, and originally I planned for the user to just change the field from "Open" to "Closed" from the dropdown menu. But they are not remembering to do this.

Is there any way that I can add a button that, when pressed, will change the value of this field from "Open" to "Closed". I figured I'd use this instead, and also have it close the form.

I tried a macro but couldn't get it to work right. I thought maybe an action query, but I'm not sure that's right either. Any help is greatly appreciated!
 
should be pretty easy if the form with the status field is still open when you push the button. Perhaps the point to insert the solution is from the form that closes the call log form. How are you closing the call log form from the other form? Are you using a macro? I can't help you if that's the case. I reccomend you change that macro to some VBA code. And right before the line of VBA code that closes the other form you can force the status field to change to "Closed". Of course, I could help you a little more if I knew more exactly what you are wanting to do.
 
Ok I have one form called Call_Add_Form that opens in add mode from a switchboard button. That's the original form where they enter information about the call, and where the status is originally defaulted to "Open".

Then I have another form called Call_Close_Form that opens in edit mode from a switchboard button where they enter when the call was closed, who it was closed with, and the resolution.

So the original form is NOT open at the time they are closing the call. But both forms pull information from the same table (called Call_Log_Table), and look almost identical, only the Call_Add form has a lot more fields visible.

Hope this made sense to you. Thanks for you quick response and any other help you can give me!
 
I think I might have something for you, I just need some more information.

**Just read your most recent post, I know have a solution for you** Give me one sec...


Angelo

[This message has been edited by Angello Pimental (edited 06-22-2001).]
 
then you should be able to use an update query. You need to make a query that will update the Call field to "Closed", based off of the current CallID, should be able to grab that from the Form I assume. Just use DoCmd.OpenQuery QueryName in the code for the OnClick event of the desired button. Does that sound right?
 
I think I have your solution, so here goes:

First create a cmd_button without the wizard, and put in the following properties:

Name: cmdclosecall
Caption: CLOSE CALL
and in the on_click property press the ... and choose code,
Insert the following code:

Private Sub cmdclosecall_Click()

If nameofcmdbutton.Caption = "CLOSE CALL" Then

statustxtbox.value = "Closed"
DoCmd.close acForm, "Call_close_form"

End If

End Sub

Now....
Create a textbox and give it the following properties:

Name:statustxtbox
Controlsource:status
Visible:No

Ok, thats it. That will change the field Status to Closed and will close your form Call_close_form.

If you have any errors or problems let me know,

Angelo
 

Users who are viewing this thread

Back
Top Bottom