Invisible Text (1 Viewer)

KabirPatel

Registered User.
Local time
Today, 20:43
Joined
Nov 16, 2006
Messages
38
Hi,

I have a form that is bound to a row in a table. The form contains text boxes that are used to store values for each column in my row.

The form also has an "Add New" button which when pressed clears all the text boxes so that users can populate the text boxes with values for a new record.

To do this I have added the following to the click event of the "Add New" button

DoCmd.RunCommand acCmdDataEntry

I also want to default the initial values of 2 of the textboxes. To do this I add the following code:

Me.TextBox1 = "Blah blah blah"

When a user presses the "Add New" button the textbox1 is populated with the relevant text but it is invisible. If I switch between the form and another application it becomes visible.

I have tried using Me.Repaint but it doesn't work.

Do you have any ideas about how this can be resolved?

Thanks
Kabir
 

Golfer

Registered User.
Local time
Today, 20:43
Joined
Jul 6, 2005
Messages
64
If you want default values set them in the underlying table under 'default value'
Hope this is what you are looking for !
 

Mile-O

Back once again...
Local time
Today, 20:43
Joined
Dec 10, 2002
Messages
11,316
When you click the Add New button wouldn't it easier just to use the following method:

Code:
DoCmd.GoToRecord , , acNewRec

No need for clearing textboxes, etc.
 

KabirPatel

Registered User.
Local time
Today, 20:43
Joined
Nov 16, 2006
Messages
38
I ended up resetting the forecolor property of the text boxes.... weird, but it did the trick.

Cheers,
Kabir
 

Mile-O

Back once again...
Local time
Today, 20:43
Joined
Dec 10, 2002
Messages
11,316
The question still remains why you would waste so much time clearing text boxes and changing colours when the single line I gave you above will clear the textbox automatically as it moves the form to a new record.
 

Users who are viewing this thread

Top Bottom