Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 52
  1. #16
    lithium is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    72

    The main purpose is that another person can select an issue in the box, change the status from active to resolved then it will drop off the list. I can't post code right now cause I'm at work and I really haven't even used to much anayway

  2. #17
    lithium is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    72
    I'm going to change this now. I will add an Edit button to the main form, when the user highlights a record in the list box, he can click it and change the status to resolved. So basically I need to find out how to get the proper record that the have selected and change the value with a query

  3. #18
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    An action query to update the record may be appropriate. Something like

    Code:
    'Change the value of the YesNo field
    'in tblMain to True where the PK value
    'matches the form's current record
    Dim strSQL As String
    strSQL = "UPDATE tblMain " & _
             "SET tblMain.YesNo_Field = -1 " & _
             "WHERE tblMain.PK_Field =" & Me.List48.Column(0)
    
    CurrentDb.Execute strSQL, dbFailOnError 'the fail on error is optional
    Last edited by ItsMe; 12-08-2013 at 04:43 PM.

  4. #19
    lithium is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    72
    Right. I haven't been able to even get the row selection to work though. I can't figure out how to know what row and pull all that information though. I tried what you mentioned with no luck

  5. #20
    lithium is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    72
    I just need to figure out how to know what row the user selected and fire off a query to change the value under Status column to "Resolved". It isn't set as yes or no rather but a combo box that had two options: either Active or Resolved

  6. #21
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    If your combo value is text then maybe you can update a string variable in the afterupdate event of the combo.

    Dim strAnswer as string
    strAnswer = Me.cmbComboName

    Then your SET clause in your SQL string would be

    "SET tblMain.YesNo_Field = '" & strAnswer & ''" & _

    you could also
    "SET tblMain.YesNo_Field = '" & sMe.cmbComboName & ''" & _

    You will want to do some validation somewhere (Before running the SQL) to make sure your combo got updated and it has a value though

  7. #22
    lithium is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    72
    That doesn't solve anything for me though. I have no "Yes/No" in the database like I mentioned and I don't need to worry about that stuff yet as I can't even get a hold of the row selection...if I can't tell which row they are clicking then I can't update the proper record in the database.

    That combo box has nothing to with it all and is on a separate page only being used when the user makes a new repair request. The only thingon my main page is a listbox full of all records in my table shown as "Active". Meaning I need to be able to simply let the user click on the proper row they want, click a command button that will now just say "Mark as Resolved" and the code for the button once clicked will figure out what record in the list is highlighted (was clicked on anyway) and then send a query to change the value in the Status column to being "Resolved".

  8. #23
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Perhaps the code in post # 13 will help you determine how to get he appropriate information.

  9. #24
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    What value in combobox RowSource can be used to uniquely identify desired record?

    Show properties of combobox:

    RowSource (sql statement)
    BoundColumn
    ColumnCount
    ColumnWidths
    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.

  10. #25
    lithium is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    72
    Sorry if that came off as angry, been working at this for hours and feeling frustrated =/.

    June7: I hope you meant listbox not combobox, this is the listbox properties:

    RowSource: SELECT [qActive].[Title], [qActive].[Assigned to], [qActive].[Requested by], [qActive].[Status], [qActive].[Priority], [qActive].[Comments] FROM qActive ORDER BY [Priority];
    Bound Column: 1
    Column count: 6

    I think I found a mishap on my part, I didn't extract the ID to be put in the listbox (I simply didn't want the user to see it though.

  11. #26
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Okay, listbox.

    The ID column can be hidden by setting its width to 0. You did not provide ColumnWidths.

    Make ID the first column with 0 width and still bind to column 1.

    Use it in code to update desired record. Back to ItsMe code in post 18. There is a critical error. Variables need to be concatenated. Reference to control on form is a variable.

    "WHERE ID = " & Me.listboxname
    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.

  12. #27
    lithium is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    72
    Hah, I think I made some headway.

    I used this:

    lblTest.Caption = Me.List48.Column(3)

    Under the Double Click Event, this at least shows me the Active status for the record I'm highlighting, but how would I twist this to fire off a query to change that value to another "resolved"?

  13. #28
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I corrected the code in Post 18. As June noted, I did not concatenate the Where criteria correctly. You could place that code in any event you wish. I would recommend that you let the user know they are updating a record though. For instance, you may want to use a msgbox like vbOKCancel or vbYesNo if you decide to include the update query in your double click event. Maybe you can bypass the msgbox and place the code in a click event of a separate control button. The user selects the record and then clicks a button to do the update.

    When you mention, "Twist". Maybe you need to check the current status of the selected record and update the record to be the opposite of its current status. You can do a validation by retrieveing the value of column 3....

  14. #29
    lithium is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    72
    I've made some good headway but hit another dead end. Right now I'm running my Edit form (User double clicks the selection from a listbox on frmMain and this Edit form should pop up, filled with the information in which they selected in frmMain). But I can't seem to figure out the proper code to fire off a SQL statement that limits it down to being the selected ID number (filtered).

    Right now I have this in my frmEdit On Load event -

    Private Sub Form_Load()
    Dim intID As Integer
    Dim strFind As String

    If Me.OpenArgs > 0 Then
    intID = Me.OpenArgs
    strFind = "SELECT * FROM Table1 WHERE ID = 1"
    DoCmd.RunSQL strFind
    Label6.Caption = strFind
    End If

    End Sub
    Basically the intID is being passed through Open Args when they double click the listbox on frmMain (it grabbed the Column 0 and sent it that way).


    ::EDIT:: The reason I used WHERE ID = 1 is just a test-case to see if it would work or not, originally this value for ID should be set to the intID variable value.

  15. #30
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    What are you trying to accomplish in the load event handler?

Page 2 of 4 FirstFirst 1234 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 09-17-2012, 10:36 AM
  2. Replies: 1
    Last Post: 09-12-2012, 12:44 PM
  3. Replies: 5
    Last Post: 07-26-2012, 12:59 PM
  4. Form not showing information in querry
    By srmezick in forum Forms
    Replies: 3
    Last Post: 11-15-2011, 01:39 PM
  5. Replies: 8
    Last Post: 04-21-2011, 05:29 PM

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