Text box width/bring to front

SorenIX

Registered User.
Local time
Today, 14:46
Joined
Jun 20, 2011
Messages
62
Hi,

I don't know much about VBA code and I'm learning it by myself while making a Access Database. I came across something I would like to do, here it is :

When I open "TodayForm", if the text box "episode_at" has its default value...

1- I would like its width becoming 5cm.

or

2- I would like it to be bring to the front.

Is that possible? What would the code look like?

Thanks for your help.
 
Last edited:
Anyone could tell me if it's possible at least? It's slowing my project. =/
 
Sure, you should be able to do this, depending on how you have it set up. Does the text box have the default set at the form level or is it in the field at the table level? It would need to be set in the control's properties in the form, even if it is already set in the table.

So, if it is set on the control's properties, you could use (in the form's ON LOAD event - you can't use OPEN event because that is too early, the recordset hasn't loaded yet):

Code:
If Me.episode_at = Me.episode_at.DefaultValue Then
    Me.episode_at.Width = 5 * 567  ' This needs to be in TWIPS and there are 567 TWIPS to a centimeter
End If
 
I have the default value set only on my form, I entered the code like this :

Code:
Private Sub Form_Load()
If Me.episode_at = Me.episode_at.DefaultValue Then
    Me.episode_at.Width = 5 * 567
End If
End Sub

It doesn't seem to do anything, am I doing something wrong? I really am an apprentice! :p
 
You're absolutely sure that the value that the control is displaying is the exact same value that is entered into the default value property of episode_at? What is the default value by the way?
 
"Sorry! :)" is the default value in the form properties.
 
Last edited:
imageshack.us/photo/my-images/685/unled2dv.jpg/ <--- Sorry couldn't make it as a link; need 10 posts...

I want to hide the new entry buttons, thing is that I can't hide directly the buttons in the design because it would also hide the one I wish to display. So in order to do that, I thought I should use the default value, which is "Sorry! :)", to ask the right "episode_at" text box to hide the right buttons beside the new entry.
 
I can't see your picture since you posted it where my work blocks public photo sharing sites. You can upload one here (if you zip it first).
 
Here you go : gamefront.com/files/20466429/Untitled+2.rar

gamefront.com is not this forum. Upload it HERE, to this forum. If you aren't already at the main advanced posting page, click the GO ADVANCED button beneath the message box in the new post you are creating. Then go down a little ways on the page and select MANAGE ATTACHMENTS. When the popup occurs, click the browse button to navigate to your zip file (and please use ZIP not RAR) and then once you have selected it and clicked OK, click the UPLOAD button. The file will have been uploaded if a blue link appears with the name of the file just below the text box where it had the name before you click the upload button. Then click the close button on that dialog and then you can submit your reply.
 
Oh right sorry, just woke up! Give me time Dx

EDIT : That should work now. Sorry, I'm really not used!
 

Attachments

EDIT :

Along with that, I'm trying to make a check box that would go check and uncheck when I click on it. That works, but it only works when I click the last one which is the new entry section and it check/uncheck the one above at the same time. How can I bind the check boxes with their own rows?

Made the thing easier to understand there :

accessforums.net/programming/text-box-width-bring-front-checkbox-14513.html#post63961
 

Attachments

Last edited:
I tried but it doesn't work. Only the last one is toggleable and check/uncheck the rest above at the same time. =/
 

Users who are viewing this thread

Back
Top Bottom