473,397 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Display for Text Box (Access 2003)

truthlover
107 100+
Is there a way to have text display in a data entry form that will not be stored as an actual value (like a default value does)?

Status bar and Tool tips wont work. I need something that will display in an empty data entry field.

Thanks!
Feb 20 '08 #1
4 2792
sierra7
446 Expert 256MB
Hi
You can use the On_Open or On_Current event of a form to automatically place text in a Textbox
Expand|Select|Wrap|Line Numbers
  1.  Me!MyTextBox = "My Text ?"
However, if you have a Bound Form and Me!MyTextBox is bound to field [MyText] (i.e. ControlSource = [MyText]) then this will be written to the database.

If the Control Source is blank, you have an Un-Bound control, so the data will be displayed but not saved anywhere, so is not a data entry box.
You could have another event read this data and then copy it to a bound contril (that could be hidden) but what are you trying to do?

S7
Feb 20 '08 #2
truthlover
107 100+
The fields are all bound controls.

What I'm trying to do is make the data entry as simple to use as possible. So I would like to have tool tips in the form of text inside the empty text field (since they'll never look at the status bar and the mouse-over tips are too easy to ignore).

I have one popup message, but even that one gets really annoying after a while and there is no room on the form to put the tips near the control

Thanks

Hi
You can use the On_Open or On_Current event of a form to automatically place text in a Textbox
Expand|Select|Wrap|Line Numbers
  1.  Me!MyTextBox = "My Text ?"
However, if you have a Bound Form and Me!MyTextBox is bound to field [MyText] (i.e. ControlSource = [MyText]) then this will be written to the database.

If the Control Source is blank, you have an Un-Bound control, so the data will be displayed but not saved anywhere, so is not a data entry box.
You could have another event read this data and then copy it to a bound contril (that could be hidden) but what are you trying to do?

S7
Feb 20 '08 #3
sierra7
446 Expert 256MB
Hi

I think what you mean is you want 'Type Your Name Here' inside the text box label 'Name' ??? or similar

(I'm not going to forgive myself for this!) I've got something like this working by making the TextBox Background Style = Transparent and placing a Label behind it with the required text. The label must be exactly the same size as your TextBox. The After_Update event on the text box is;
Expand|Select|Wrap|Line Numbers
  1.  Private Sub Text13_AfterUpdate() 
  2. If Me.Text13 <> "" Then
  3.      Me.Text13.BackStyle = 1
  4. Else
  5.      Me.Text13.BackStyle = 0
  6. End If
  7. End Sub
  8.  
so the label is visible until there is data in the text box, then the BackStyle is changed to Normal (1) to hide the label.

You would have to do this for every field on your form, then you would have to copy and paste all of these bits of code into a new Sub, lets call it DisplayHelp, which you would need to call in the On_Current event of the Form, so that it would reset for each record. I suppose you could have the Label backcolour different to the TextBox then it would highlight what was Data and what was Help text. Different Fonts might help too (It sound like this is growing on me!)

If you really liked the effect you could probably wrap it up in a Public module.
Expand|Select|Wrap|Line Numbers
  1.  
  2. Sub DisplayHelp(Fname As Form)
  3. Dim frm As Form
  4. Dim ctl As Control
  5.  
  6. Set frm = Fname 
  7.  
  8. For Each ctl In frm.Section(acDetail).Controls
  9. With ctl
  10. Select Case .ControlType
  11. Case acComboBox
  12. If .Value <> "" Then
  13. .BackStyle =1
  14. Else
  15. .BackStyle =0
  16. EndIf
  17.  
  18.  
  19. Case acTextBox
  20. If .Value <> "" Then
  21. .BackStyle =1
  22. Else
  23. .BackStyle =0
  24. EndIf
  25. End Select
  26. End With
  27. Next ctl
  28.  
  29. End Sub
  30.  
  31.  
You would call it by putting
Expand|Select|Wrap|Line Numbers
  1. DisplayHelp Me
in all the after_updates and On_Currents where needed

I HAVE NOT TESTED this and it may need polishing a bit but should give you the idea.

Best of luck

S7
Feb 21 '08 #4
truthlover
107 100+
I think what you mean is you want 'Type Your Name Here' inside the text box label 'Name' ??? or similar
Yes, that's exactly what I want.

That's an interesting solution. I'll give it a try, thanks!

(I'm not going to forgive myself for this!) I've got something like this working by making the TextBox Background Style = Transparent and placing a Label behind it with the required text. The label must be exactly the same size as your TextBox. The After_Update event on the text box is;
Expand|Select|Wrap|Line Numbers
  1.  Private Sub Text13_AfterUpdate() 
  2. If Me.Text13 <> "" Then
  3. Me.Text13.BackStyle = 1
  4. Else
  5. Me.Text13.BackStyle = 0
  6. End If
  7. End Sub
  8.  
so the label is visible until there is data in the text box, then the BackStyle is changed to Normal (1) to hide the label.

You would have to do this for every field on your form, then you would have to copy and paste all of these bits of code into a new Sub, lets call it DisplayHelp, which you would need to call in the On_Current event of the Form, so that it would reset for each record. I suppose you could have the Label backcolour different to the TextBox then it would highlight what was Data and what was Help text. Different Fonts might help too (It sound like this is growing on me!)

If you really liked the effect you could probably wrap it up in a Public module.
Expand|Select|Wrap|Line Numbers
  1.  
  2. Sub DisplayHelp(Fname As Form)
  3. Dim frm As Form
  4. Dim ctl As Control
  5.  
  6. Set frm = Fname 
  7.  
  8. For Each ctl In frm.Section(acDetail).Controls
  9. With ctl
  10. Select Case .ControlType
  11. Case acComboBox
  12. If .Value <> "" Then
  13. .BackStyle =1
  14. Else
  15. .BackStyle =0
  16. EndIf
  17.  
  18.  
  19. Case acTextBox
  20. If .Value <> "" Then
  21. .BackStyle =1
  22. Else
  23. .BackStyle =0
  24. EndIf
  25. End Select
  26. End With
  27. Next ctl
  28.  
  29. End Sub
  30.  
  31.  
You would call it by putting
Expand|Select|Wrap|Line Numbers
  1. DisplayHelp Me
in all the after_updates and On_Currents where needed

I HAVE NOT TESTED this and it may need polishing a bit but should give you the idea.

Best of luck

S7
Feb 21 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: MJ | last post by:
Hi, I'm hoping this is relatively easy. I have a report based on a query - when you run the report, a form opens up and you are prompted for a date range. These are combo boxes (ie. January...
3
by: deko | last post by:
I store hyperlinks as text in a table like this: Invoice11-21-2003.pdf#file://P:\Finance\PrefVendors\Receipts\Invoice11-21-20 03.pdf I need to run a report that lists the documents - or...
1
by: MJ | last post by:
I'm not following... where do I put that? I put a textbox on my report and put the following property for it: =!!.Value This displays 1 (for January 2003). How do I get it to display...
3
by: google | last post by:
This is something I've done plenty of times in '97, but I can't seem to get it to work correctly in Access 2003. Say, for example, I have a form with an unbound combobox, the data source is a...
0
by: M. David Johnson | last post by:
I cannot get my OleDbDataAdapter to update my database table from my local dataset table. The Knowledge Base doesn't seem to help - see item 10 below. I have a Microsoft Access 2000 database...
9
by: dennist685 | last post by:
Walkthrough: Creating a Web Page to Display Access Database Data I've started the above walkthrough. However, near the beginning it gives the following instructions To set permissions in the...
4
by: Neil | last post by:
I just noticed that control tips aren't working in any of my databases. I recently installed Access 2003, and created a database in it, and noticed that control tips weren't working in my controls....
4
by: exrcizn | last post by:
I am creating a query in Access 2003 that basically displays data in certain fields in a table (plain and simple basic stuff). I have a field in the table that may or may not contain data. If the...
2
by: Dale | last post by:
Access 2003 I have an access database used for scoring a high school sporting event. Data is entered as scores are turned in from the different events throughout the day. I would like to...
16
by: Wayne | last post by:
I've read that one method of repairing a misbehaving database is to save all database objects as text and then rebuild them from the text files. I've used the following code posted by Lyle...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.