Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 18th, 2004, 07:18 PM
Authorized User
Join Date: Apr 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default Enable button when textbox is populated

Hi All
I'm only a beginner when it comes to VBA and Access so I'd really appreciate some help.
I'm trying to enable a button on a form, only when a certain textbox has been populated ( text entered ).
I'm reading Beginning Access 2002 VBA, but I'm only a couple of hundred pages into it and I haven't so far been able to figure this one out.
Regards / Fred
Old April 19th, 2004, 07:26 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG

Hi, Fred. Welcome to P2P!

To enable a button only when a textbox is filled, put this on the form's ON CURRENT event and also in the textbox's AFTER UPDATE event.

Me.cmdMyButton.Enabled = Not IsNull(Me.txtMyTextBox)

Where you put your REAL names for cmdMyButton and txtMyTextBox. Basically, if the textbox is empty (null), the ISNULL function returns TRUE. The NOT in front turns the TRUE into FALSE. Therefore, the enabled becomes FALSE and button dims. If the textbox is not empty ISNULL returns FALSE. The NOT turns that into a TRUE, the enabled property turns into TRUE, and the button can be clicked.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Old April 19th, 2004, 09:02 PM
Authorized User
Join Date: Apr 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks heaps.No doubt I'll come back for more basic questions.

Cheers / Fred

Similar Threads
Thread Thread Starter Forum Replies Last Post
not enable textbox or combobox font color SabinoFonseca VB.NET 2002/2003 Basics 1 March 15th, 2007 01:52 PM
Enable Update and Enable Delete check boxes don't mihabib ASP.NET 2.0 Basics 2 December 7th, 2006 11:44 AM
Button enable property - Late binding aruchamy .NET Framework 2.0 2 June 18th, 2006 09:44 AM
Using textbox, button control to search database aad1 C# 4 May 17th, 2006 06:54 PM
bag in vb.net,set enable for textBox q8z Beginning VB 6 0 October 21st, 2004 04:08 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.