473,394 Members | 1,641 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,394 software developers and data experts.

Text Box Assistance

I have the below listed code in a text box:

Private Sub TypeofSurgery_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
Dim strTitle As String
Dim intStyle As Integer

If IsNull(Me.TypeofSurgery) Then
strMsg = "Pick A Value From The List Box."
strTitle = "This Is A Required Field"
intStyle = vbOKOnly
MsgBox strMsg, intStyle, strTitle
Cancel = True
End If
End Sub

The problem is when I leave the text box empty I can go on to the next
field. I do not want the box empty. I do not want to leave this text
box until a selection is made.

Any help would be appreciated.

Kenny G
Nov 12 '05 #1
3 1322
Put the following code in the OnEnter event of the next field:

If IsNull(Me!TypeOfSurgery) Then
MsgBox "Enter Type Of Surgery First",,"Missing Type Of Surgery"
Me!TypeOfSurgery.SetFocus
End If
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Kenny G" <kg****@hotmail.com> wrote in message
news:81**************************@posting.google.c om...
I have the below listed code in a text box:

Private Sub TypeofSurgery_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
Dim strTitle As String
Dim intStyle As Integer

If IsNull(Me.TypeofSurgery) Then
strMsg = "Pick A Value From The List Box."
strTitle = "This Is A Required Field"
intStyle = vbOKOnly
MsgBox strMsg, intStyle, strTitle
Cancel = True
End If
End Sub

The problem is when I leave the text box empty I can go on to the next
field. I do not want the box empty. I do not want to leave this text
box until a selection is made.

Any help would be appreciated.

Kenny G

Nov 12 '05 #2
I created a text field called Text0
In the OnExit event (which you can cancel) I entered
If IsNull(Me.Text0) Then
msgbox "Enter Data"
Cancel = True
Endif
Kenny G wrote:
I have the below listed code in a text box:

Private Sub TypeofSurgery_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
Dim strTitle As String
Dim intStyle As Integer

If IsNull(Me.TypeofSurgery) Then
strMsg = "Pick A Value From The List Box."
strTitle = "This Is A Required Field"
intStyle = vbOKOnly
MsgBox strMsg, intStyle, strTitle
Cancel = True
End If
End Sub

The problem is when I leave the text box empty I can go on to the next
field. I do not want the box empty. I do not want to leave this text
box until a selection is made.

Any help would be appreciated.

Kenny G


Nov 12 '05 #3
Many thanks for both of your assistance. This is the final sub that worked.

Private Sub TypeofSurgery_Exit(Cancel As Integer)
If IsNull(Me.TypeofSurgery) Then
MsgBox "Data Entry Required - Select From List Provided"
Cancel = True
End If
End Sub

Thanks again.

Kenny G

U N Me <un**@together.com> wrote in message news:<3F***************@together.com>...
I created a text field called Text0
In the OnExit event (which you can cancel) I entered
If IsNull(Me.Text0) Then
msgbox "Enter Data"
Cancel = True
Endif
Kenny G wrote:
I have the below listed code in a text box:

Private Sub TypeofSurgery_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
Dim strTitle As String
Dim intStyle As Integer

If IsNull(Me.TypeofSurgery) Then
strMsg = "Pick A Value From The List Box."
strTitle = "This Is A Required Field"
intStyle = vbOKOnly
MsgBox strMsg, intStyle, strTitle
Cancel = True
End If
End Sub

The problem is when I leave the text box empty I can go on to the next
field. I do not want the box empty. I do not want to leave this text
box until a selection is made.

Any help would be appreciated.

Kenny G

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dalan | last post by:
I need assistance regarding how to structure code for preventing values being entered into three text fields. Although the two of the three text fields can have values concurrently, it is not...
2
by: Rolan | last post by:
Need some assistance with regard to the following basic Function to change digits to text, i.e., 295.78 = RTELG. Any suggestions or ideas will be appreciated. Thanks. Function dtt(Cost As...
1
by: David | last post by:
Hi All I am trying to read a LongVarChar field from SQL Server using the SqlDataReader and I am having trouble. Can anyone provide an example or assistance. I found the article...
1
by: blangela | last post by:
I am currently teaching 2 part-time (one evening per week) C++ courses using the Deitel & Deitel "C++ How To Program" text. Each course is 13 weeks in length, including time for labs and exams. ...
5
by: Smalley | last post by:
I have a form with a text box and I only want users to only be able to enter in 7 numbers(ID's) and that is it. The 7 numbers will vary. I need assistance on limiting the text box field to only...
2
by: =?Utf-8?B?TXIgQg==?= | last post by:
I had originally posted this in another thread, but did not get and results. I appologize for cross posting but I really would like to get some assistance with this. I am new to developing in...
1
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being...
3
by: gaurav92K | last post by:
sir i am working in a company . there are many pc. i want to use remote assistance. i configure all group policy which are related remote assistance.and i enable service through remote in system...
1
DebadattaMishra
by: DebadattaMishra | last post by:
Introduction In case of rich applications, you must have observed that a text field behaves like a dynamic combo box. When the user enters some characters in the text field, a popup will come up...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.