Results 1 to 8 of 8
  1. #1
    NoiCe is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2008
    Posts
    24

    Help with creating button to update status

    Hello,

    I'm new to VBA and I'm trying to create a button in my form that when clicked will bring up a message that asks the user if they want to really "close" the ticket. If user selects yes, it will change the text box I have from OPEN (default value) to CLOSE and also update the status field with this info in the underlying table. Then the button should be grayed out whenever the status is closed. If no is selected then the status should remain as is...OPEN. This is for a help desk database.

    Any help that you can provide is greatly appreciated!



    Thank you.
    J

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,649
    Code can easily set value in textbox and if textbox is bound to field, the value will pass into record. Graying the button depends on form design. Is the button in Detail section and is form in Continuous or Datasheet view?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    NoiCe is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2008
    Posts
    24
    It is in the Details section and I believe it's continous form. Screenshot attachedClick image for larger version. 

Name:	image.jpg 
Views:	15 
Size:	243.2 KB 
ID:	19640

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,649
    Me!Status = "Closed"

    Why bother graying the button? So what if they click it again, it just "closes" the record again, no harm.

    Enabling or disabling the button will be in effect for all records.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    NoiCe is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2008
    Posts
    24
    Quote Originally Posted by June7 View Post
    Me!Status = "Closed"

    Why bother graying the button? So what if they click it again, it just "closes" the record again, no harm.

    Enabling or disabling the button will be in effect for all records.
    June7, I need the question to be asked "Do you want to close this record" if user selects yes then me!status="closed". So basically I need a vbYes/No. Just not sure how to write this and where.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,649
    If MsgBox("Do you want to close this record?", vbYesNo) = vbYes Then
    Me!Status = "Closed"
    End If
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    NoiCe is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2008
    Posts
    24
    Quote Originally Posted by June7 View Post
    If MsgBox("Do you want to close this record?", vbYesNo) = vbYes Then
    Me!Status = "Closed"
    End If
    Thanks June, this worked, however I tried to put this into a module and it keeps bringing up an error. How would I add this to a module?

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,649
    What error? If it worked, how can there be an error?

    You said you want a button. This code would go in the button Click event procedure.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Check if record exist and update the status
    By JustinC in forum Access
    Replies: 4
    Last Post: 08-17-2014, 01:39 PM
  2. Help creating Project Status sheet in Access
    By jet_speed in forum Access
    Replies: 7
    Last Post: 09-27-2013, 09:41 PM
  3. Replies: 4
    Last Post: 06-20-2013, 10:26 PM
  4. Replies: 14
    Last Post: 05-13-2013, 12:53 PM
  5. Creating a '+1'-button
    By Propaganistas in forum Forms
    Replies: 3
    Last Post: 10-30-2010, 03:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums