Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    SorenIX's Avatar
    SorenIX is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    15

    Text box width/bring to front and Checkbox

    Hi,



    I'm working in something since some weeks now and I came accross many questions that I solved by myself and with people help and now I come across two problems I really can't solve myself because I really have zero knowledge in VBA.

    I do start to know a bit about it because I work with it more often now but it's not enough so I can figure out anything. Here are two my problems :

    First, I want to hide the buttons and the check box beside the new entry section. This is a form that kind of act like a report and the last section on the picture are the same fields as the previous ones but set with their default values so it looks better. I wanted to turn off "Allow Addition" but it turns out that the title which calculate the weekday is empty when I turn it off. I thought I could make the text box come in the front or make its width longer so that when it has its default value it comes infront of the buttons and the checkbox. boblarson told me to try this :

    Private Sub Form_Load()
    If Me.episode_at = Me.episode_at.DefaultValue Then
    Me.episode_at.Width = 5 * 567
    End If
    End Sub
    I get no error, though nothing happens.

    Second, the checkbox won't toggle with it's own row, the only toggleable one is the one in the new entry section and it check/uncheck the others above at the same time. When I click on the others nothing happens, like it was locked, but it's not when I check in the properties.

    Thanks for your help in advance. Really wish to make it work >.<

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,959
    Not understanding first part. What textbox needs to come in front? You want the checkbox and buttons hidden when the textbox shows?

    As for the second question, the check box is not a bound control. The setting in one record applies to all. It's just that in Continuous or Datasheet view you can see that effect.
    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
    SorenIX's Avatar
    SorenIX is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    15
    I half fixed the first problem with this :

    Code:
    Private Sub Form_Load()
    If Me.episode_at = "Sorry! :)" Then
       Me.episode_at.Width = 6 * 567
    End If
    End Sub
    Seems like DefaultValue wasn't good for some reason, so I entered THE default value. Thanks boblarson for the hint!
    The problem is that it only works when there's no record on the weekday... (Picture2.zip)

    As for the second problem, I don't really understand what you mean... Is there a way I could get it to work? :S
    Though, I do have a Yes/No in my table and when I try the checkbox on another form it works the way it should.
    But I think I kinda get what you mean... I will try to find another way.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,959
    You would need a Yes/No field in table so the checkbox would have something to be bound to. Go ahead and create the field, include it in the form's RecordSource, and set it as the ControlSource for checkbox. What happens when you check a box?
    EDIT: Okay, I see your post edit and you are on track.

    You need an Else in the code. What should happen if the values don't equal?
    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
    SorenIX's Avatar
    SorenIX is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    15
    I don't think it would work because the way it's built. =/
    episode_at is the the key in that table. I will have to find another way... something like a complete independant checkbox or just take it out and do with it.

    My main problem is the first one atm. I will still look for the checkbox meanwhile, because I really have no idea about that one.

    EDIT : It must stay the way it is in the properties. It means Width = 2,362cm.

  6. #6
    SorenIX's Avatar
    SorenIX is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    15
    I don't know what a ELSE case look like but I guessed it was something that :

    Code:
    Private Sub Form_Load()
    If Me.episode_at = "Sorry! :)" Then
       Me.episode_at.Width = 6 * 567
    Else: Me.episode_at.Width = 2 * 567
    End If
    End Sub
    Nothing happens but I don't get any error so...


    EDIT :

    I tried this :

    Code:
    Private Sub Form_Load()
    Me.episode_at = "Sorry! :)"
       Me.episode_at.Width = 6 * 567
    End Sub
    It was hiding every buttons and the first record became "Sorry! :)"
    I guess it's normal at some points... @_@

    Isn't there I way we could ask the "New addition" section directly?

    I tried this :

    Code:
    Private Sub Form_Load()
    AdditionalData.Width = 6 * 567
    End Sub
    But it says "Object required"

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,959
    If setting Width like that is possible then the If Then Else should work. Step debug, follow the code as it executes, one line at a time.

    Just remembered, I use twips to set Width, like:
    .tbxBox1.Width = 11520 'twips, 1 inch = 1440 twips
    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
    SorenIX's Avatar
    SorenIX is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    15
    How do I follow step if there's no error? =/

    EDIT :

    Don't know if you saw but, I tried this :

    Code:
    Private Sub Form_Load()
    AdditionalData.Width = 6 * 567
    End Sub
    But it says "Object required". I know that there's no target for that expression, but can't we do something with it?

    EDIT #2 :

    Code:
    Private Sub Form_Load()
    AdditionalData , episode_at.Width = 6 * 567
    End Sub
    Still not... Trying! Sorry I really don't know the structure it requires... >.<
    I think it only works when the addition is the first row... that's why we need to redirect it to the additional row when there's other records.
    I'm sure that way it would work.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,959
    What is this form structure? Is it form/subform? Subform in Continuous or Datasheet view?

    Could you attach file to post? If too large, make copy, delete most records, delete all but the objects related to this issue, run Compact & Repair.

    It's late, if you can do that, I will look at tomorrow.
    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
    SorenIX's Avatar
    SorenIX is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    15
    EDIT :

    I found the way to send it to the addition record! It was so easy... I just don't know enough to figure out without looking arround everywhere. x)
    Now the problem is that it also hide the buttons above... --"

    Code:
    Private Sub Form_Load()
    DoCmd.GoToRecord , , acNewRec
    If Me.episode_at = "Sorry! :)" Then
       Me.episode_at.Width = 6 * 567
    Else: Me.episode_at = 2 * 567
    End If
    End Sub

  11. #11
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Continuous forms won't allow you to set the different controls as visible or invisible because it is really the same control and if you set it, it is that for every record.

  12. #12
    SorenIX's Avatar
    SorenIX is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    15
    That's what I thought, but since I could set the buttons - and + to work with their own rows, I thought it was somehow possible... =/

    EDIT :

    Then I will change something that might get it to work, but I don't know how I'm suppose to do that. The only way I see I could get it to work is turning off the new additions and replace it by the form footer. But when I turn it off, the text box acting as title which calculate the weekday won't calculate when there's no record.

    Is there something I could do?

    I'm also trying to make this work :

    Code:
    Private Sub Form_Load()
    If Detail = Empty Then
       Label29.Visible = True
    End If
    End Sub
    I want the label on the form footer to be visible if the detail section is empty. (got no record for the weekday)

    EDIT :

    Could make it half work with :

    Code:
    Private Sub Form_Load()
    DoCmd.GoToRecord , , acFirst
    If title.Visible = True Then
       Label29.Visible = False
    End If
    End Sub
    It bugs when there's no record since it can't DoCmd.GoToRecord , , acFirst

  13. #13
    SorenIX's Avatar
    SorenIX is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    15
    Just another small question :

    Is it possible to create a mouse hover event on a button?

  14. #14
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    It is possible, however depending on the rest of the form and what you are intending for the mouse over then it can be a bit problematic. But there is a MouseOver event.

  15. #15
    SorenIX's Avatar
    SorenIX is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    15
    I've read a bit about it... The problem seems to be when the mouse move out of the button.

    EDIT :

    I want that when the mouse is over the button, it moves a bit on the right. So I tried this as an example but the problem is that it doesn't change to 5 * 567, but 8 * 567, and it stays 8 * 567 when I move out.

    Code:
    Private Sub Command4_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If MouseMove Then
    Me.Command4.Width = 5 * 567
    Else: Me.Command4.Width = 8 * 567
    End If
    End Sub
    It works in my head!

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

Similar Threads

  1. Replies: 5
    Last Post: 02-20-2011, 08:22 PM
  2. export query to fixed width text
    By eladz949 in forum Import/Export Data
    Replies: 1
    Last Post: 02-08-2011, 07:28 AM
  3. export query to fixed width text
    By eladz949 in forum Import/Export Data
    Replies: 5
    Last Post: 01-01-2011, 03:28 PM
  4. Bring in numeric text field to access from excel
    By Sck in forum Import/Export Data
    Replies: 1
    Last Post: 12-13-2010, 04:07 PM
  5. Replies: 2
    Last Post: 03-28-2010, 04:15 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