Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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 February 10th, 2005, 11:56 AM
Authorized User
 
Join Date: Dec 2004
Location: Belfast, Antrim, United Kingdom.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error handling

Hi

I'm trying to force a field to be input with some data ie test if its null, by using the code below. I'm fairly new to this game so please be gentle with the mickey-taking.

Sub checkerrors()
Dim vlastname As Variant

Set vlastname = Forms!frmInput1.[txtLastName]

If vlastname = ("") Then
    GoTo testAH
End If

testAH:
MsgBox ("Please enter a Last Name")


End Sub

Cheers
Tony
__________________
Cheers
Tony
 
Old February 10th, 2005, 12:27 PM
Authorized User
 
Join Date: Jan 2005
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try:

If IsNull(vlastname) then
   MsgBox "Enter a Last Name" , vbInformation + vbOKOnly, "Enter Last Name"
Else
   Do Whatever
End IF

 
Old February 11th, 2005, 05:32 AM
Authorized User
 
Join Date: Dec 2004
Location: Belfast, Antrim, United Kingdom.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

great stuff...cheers

Cheers
Tony




Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Handling harpua Beginning PHP 0 October 28th, 2006 12:05 PM
error handling Abhinav_jain_mca General .NET 5 December 21st, 2005 01:12 AM
Error Handling twbit BOOK: ASP.NET Website Programming Problem-Design-Solution 1 May 3rd, 2005 09:18 PM
Error Handling zaeem Classic ASP Basics 2 November 14th, 2003 10:42 AM
Error handling ! ittorget Classic ASP Professional 2 November 14th, 2003 09:44 AM





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