Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    gatsby is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    114

    Control Cant Be Edited; It's Bound to Expression

    Is there a possiblity that a control CAN be edited that is bound to an expression?

    All of my Form properties are set to editable, no locks, allow deletion, allow addition, etc.



    I just want a text box in a Form to be edited by users if they want to update it but they CAN'T since it is bound to an expression.

    Any expert who can help me with this?

    Thanks a lot!

  2. #2
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    pswd = InputBox("Requires a password", "Warning ")
    If pswd <> "1234" Then
    MsgBox ("You are not authorized"), vbOKOnly, "Message"
    Exit Sub
    End If
    txtbox = "Message" & vbCrLf & "Warning "
    Result = MsgBox(txtbox, vbYesNo, "Message")
    If Result = vbYes Then
    'Delete record
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
    Else
    MsgBox ("Message"), vbOKOnly, "ABORTED"
    Exit Sub
    End If

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    If you are using an unbound textbox what is it you want the User to edit, the expression itself?

  4. #4
    gatsby is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    114
    Quote Originally Posted by ItsMe View Post
    If you are using an unbound textbox what is it you want the User to edit, the expression itself?
    not the expression but the value itself in the texbox. like for instance, the issue is OPEN in the textbox and i wanted the user to update it and change it to CLOSED.

  5. #5
    gatsby is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    114
    Quote Originally Posted by azhar2006 View Post
    pswd = InputBox("Requires a password", "Warning ")
    If pswd <> "1234" Then
    MsgBox ("You are not authorized"), vbOKOnly, "Message"
    Exit Sub
    End If
    txtbox = "Message" & vbCrLf & "Warning "
    Result = MsgBox(txtbox, vbYesNo, "Message")
    If Result = vbYes Then
    'Delete record
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
    Else
    MsgBox ("Message"), vbOKOnly, "ABORTED"
    Exit Sub
    End If

    Thanks azhar2006, but where should i place this? sorry but i am not an expert in Access.

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I guess I am going to answer your question by saying, "No".

    Why not provide us with a short explanation of what your are trying to do with the user input, without describing your data structure or other technical aspects about your form/DB?

    e.g. I want the user to type their age into a textbox so I can then decide which class to enroll them in.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,970
    Cannot input data to a textbox that has an expression. Period.

    If the OPEN value is calculated then why isn't the CLOSED value also calculated?
    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.

  8. #8
    gatsby is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    114
    Quote Originally Posted by June7 View Post
    Cannot input data to a textbox that has an expression. Period.

    If the OPEN value is calculated then why isn't the CLOSED value also calculated?

    because i dont know what expression to create to make it open at the same time the value of the textbox is correct. i attached my database for further check.

    when a user click a Discipline on the top right part (drop down button), items will be shown on the ListBox. once the user pick/click on an item, the information will show below. those information below should be editable for the user to update/edit the item information BUT i dont know what expression or code to place that the information will still be correct once a user pick an item. thats why im here asking for help.
    Attached Files Attached Files

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,970
    Why are you just reflecting the listbox data in the textboxes below listbox? If you want those textboxes to be editable then they should be bound to fields of form's RecordSource. You also need code to filter the form for the record selected in the listbox. Then code should requery the listbox after data edits are committed to table so it displays the changed data.
    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. #10
    gatsby is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    114
    i tried to bound it to the form's Recordsource but the items are not showing. for the code, i dont know what code should i put. can u do a sample so i can follow?

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,970
    Existing records will not show because the form DataEntry property is set to Yes. This means the form can only be used to enter new records. If you want to view and edit existing then change this to No.

    The Module and HoldStatus comboboxes do nothing to filter the listbox. The criteria in the listbox RowSource sql uses LIKE operator but does not have wildcard so the LIKE is ineffective, might as well be =.

    Dynamic parameterized queries (as you are using for the listbox and form) is one way to filter records.

    Need code in the listbox AfterUpdate event to requery the form: Me.Requery

    Cannot select item in listbox - get rid of the listbox Enter event code.
    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. #12
    gatsby is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    114
    done with setting it to NO. done placing Requery in AfterUpdate but still i cant edit the value in the textbox. done with the Enter event code also.

    about the Module and HoldStatus, im still not done or im still not there in filtering the items so just leave it as is. sooner, if i will have problems with that i will post it here again. =)

  13. #13
    AnandKhinvasara is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Posts
    31
    Textboxes with Expression cannot be edited.

    Rather create a module, that is called from AfterUpdate property of the control(s) that causes change to value of this particular current "textbox with expression".

    If you are not expert in VBA, provide us with the logic you want with proper control names, and I will drop you a code that you can paste in a module, and then call from AfterUpdate property of controls.

  14. #14
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by gatsby View Post
    ...but still i cant edit the value in the textbox..
    Are you understanding that users typically do not edit expressions? If you add an expression to a textbox, the only thing that can be edited is the expression and this must be done during Design Time. There should not be any changes to your unbound textbox with the expression by the user.

    Having said that, the original expression could cause the textbox to dynamically display info because of user input elsewhere.

  15. #15
    gatsby is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    114
    Quote Originally Posted by AnandKhinvasara View Post
    Textboxes with Expression cannot be edited.

    Rather create a module, that is called from AfterUpdate property of the control(s) that causes change to value of this particular current "textbox with expression".

    If you are not expert in VBA, provide us with the logic you want with proper control names, and I will drop you a code that you can paste in a module, and then call from AfterUpdate property of controls.

    ListBox (name of the listbox where all items show after choosing a category in drop down button)
    lkpAssembly (name of the drop down button)
    Text215, Text185, Text207 and so on...(name of the texboxes) ; for now i used this expression =
    [ListBox].[column](0) up to [column](11) in each texboxes.

    i attached my database in one of my replies.

    i know now that textboxes that are bound with expression cant be edited if so it could do some coding in AfterUpdate. and thats one of weaknesses; too much coding.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Input Box Bound to Expression
    By CementCarver in forum Forms
    Replies: 13
    Last Post: 10-12-2013, 04:13 PM
  2. Replies: 13
    Last Post: 01-11-2012, 09:44 PM
  3. Control can't be edited
    By TracyBell in forum Database Design
    Replies: 11
    Last Post: 05-17-2011, 01:38 PM
  4. Replies: 1
    Last Post: 06-23-2010, 09:05 AM
  5. Replies: 2
    Last Post: 07-30-2009, 08:02 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