Ok I got it now, thank you everyone for that. Now I have another question. I'm creating an error report from, if a textbox is blank then it'll display a text in another textbox stating "Textbox is blank, please enter a value" etc... So it will look something like this.... - Private Sub FormCheckButton_Click()
-
If TextboxA = "" Then
-
ErrorBox = "TextBoxA cannot be blank, please enter value"
-
End If
Now when TextBoxA is answered, and when the FormCheckButton is clicked for another form review, how do I remove the "TextBoxA cannot be blank, please enter value" message from the ErrorBox? Hopefully all this made sense.
** Edit **
This question was asked in another thread ( What is the VB code for looking up a value in a table?). Please post new questions in their own threads in future.
11 2578 @Jonathan Austin
you can use something like this: - Private Sub Check1_Click()
-
If Me.check1 = -1 Then
-
Me.errorbox= ""
-
DoCmd.OpenForm "your form name"
-
Me.check1 = 0
-
End If
-
End Sub
-
hope this helps
Unfortunately that won't, because my error box will be compiled with other text, so I just want to eliminate certain text. I'll write it out for better understanding. - Private Sub ReviewButton_Click()
-
If ComboBoxA = "" Then
-
ErrorBoxA.Text = "ComboBoxA Cannot Be Blank, Answer Is Required"
-
End If
-
-
If ComboBoxB = "" Then
-
ErrorBoxA.Text = ErrorBoxA.Text & "ComboBoxB Cannot Be Blank, Answer Is Required"
-
End If
-
-
If ComboBoxC = "" Then
-
ErrorBoxA.Text = ErrorBoxA.Text & "ComboBoxC Cannot Be Blank, Answer Is Required"
-
End If
-
-
End Sub
ErrorBoxA should read,
ErrorBoxA: ComboBoxA Cannot Be Blank, Answer Is Required
ComboBoxB Cannot Be Blank, Answer Is Required
ComboBoxC Cannot Be Blank, Answer Is Required
I want to know, if ComboBoxB IS NOT blank, what would be the code to remove the "ComboBoxB Cannot Be Blank, Answer Is Required" text from ErrorBoxA while leaving the rest?
so, you want to prevent any of the comboboxes from being null or blank , and want to view the messages in textbox istead of msgbox, is that right?
Yes thats correct, after my personnel enter information, (its alot of information to be enter, so there will be entries that may be over looked.) So any blank entries I want the errors to show up as text in the error boxes (error boxes = textboxes) not msgbox.
@Jonathan Austin
- I could have all the fields required, but it would be annoying to hear 'dings' after each one, which by the way, all entries are required.
@Jonathan Austin
So, It would be like this: - Private Sub Form_BeforeUpdate(Cancel As Integer)
-
If IsNull(Me!Text1) Then
-
Me.Text2 = "text 1 is blank, it is required"
-
Cancel = True: Me.Text1.SetFocus
-
ElseIf Not IsNull(Me.Text1) Then
-
Me.Text2 = ""
-
End If
-
If IsNull(Me!T5) Then
-
Me.T6 = "text 5 is blank, it is required"
-
Cancel = True: Me.T5.SetFocus
-
ElseIf Not IsNull(Me.T5) Then
-
Me.T6 = ""
-
End If
-
End Sub
-
in the demo, generate an ID and try to move to the next record
hope this helps
Actually I figured out what I needed, I'll post it, it may help others on this. Its basically like creating your own verison of an error report.
Check this out
NeoPa 32,556
Expert Mod 16PB Jonathan Austin: Ok I got it now, thank you everyone for that. Now I have another question. I'm creating an error report from, if a textbox is blank then it'll display a text in another textbox stating "Textbox is blank, please enter a value" etc... So it will look something like this.... - Private Sub FormCheckButton_Click()
-
If TextboxA = "" Then
-
ErrorBox = "TextBoxA cannot be blank, please enter value"
-
End If
Now when TextBoxA is answered, and when the FormCheckButton is clicked for another form review, how do I remove the "TextBoxA cannot be blank, please enter value" message from the ErrorBox? Hopefully all this made sense.
The simple answer to this is : - Private Sub FormCheckButton_Click()
-
ErrorBox = IIf(IsNull(Me.TextBoxA), _
-
"TextBoxA cannot be blank, please enter value", _
-
Null)
-
End If
I'd suggest rather that this code be put in TextBoxA_AfterUpdate() though, unless you have a good reason for wanting to make the operator work to get the response.
NeoPa 32,556
Expert Mod 16PB Jonathan Austin: Actually I figured out what I needed, I'll post it, it may help others on this.
As a general rule yes. On the other hand posting an attachment as a solution on a forum like this is pretty much a waste of time.
If people are scanning through web pages to see if they've found something that can help them they want to be able to see it without downloading, opening, navigating to the relevant part, etc before they see what they're after.
Attachments are for things a little more complicated than simple concepts easily shown in a few lines of code.
Please feel free to post your solution if you think it will help. We are always pleased to see such responses. Particularly from those that ask the question in the first place, as it indicates they've learned something from visiting Bytes, which is fundamentally what we are aiming for.
NeoPa 32,556
Expert Mod 16PB
As the question has changed from the original one (to include the idea that multiple error messages are included in the TextBox) I will suggest a more appropriate alternative. At least I will outline the concept for now. The previous code indicates some of what is required as building blocks.
Firstly, each control that has the potential for producing an error message in [TextBoxA] would need an AfterUpdate event procedure which calls a separate procedure, we'll call this UpdateError(), that works out what the contents of that control should be. There would be code within UpdateError() to handle each of the said controls. For each control there would be code, similar to that found in post #9, to set or clear the part related to that control depending on the current contents of the control.
Separating each message from the next would be done by including the inbuilt value vbNewLine. Only required for controls that actually trigger error messages of course.
@NeoPa
that's true Neopa, We have learned a lot of things from here
thank you
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Steve |
last post by:
I have several pairs of synchronized subforms in an application. I have a Delete
button for each pair that uses the following code or similar to delete a record
in the second subform:
...
|
by: Ricardo Corsi P. Cesar |
last post by:
I have many textbox in my webform, but i want clear all of them with on
single step.
Someone have the code ?
Thks
|
by: Jeremy Ames |
last post by:
I have a datagrid that updates the table using a stored procedure. The stored procedure is confirmed to complete correctly, yet the sql data adapter is returning an error that my application is...
|
by: Eric |
last post by:
When i try to run that method in my continuous form it gives error
message:
invalid operation
Here txt is the textbox which bind with the table tbl_Events
Private Sub Form_Load()
Dim qry As...
|
by: bruce24444 |
last post by:
I am designing a database to use a work to assign files to certain people. Form includes Date textbox, File Number textbox, File Type combobox and Assigned To combobox. The form is working fine and...
|
by: dancer |
last post by:
I am using Framework 1.1.4322.
Who can tell me why I'm getting this error? My code follows
Compilation Error
Description: An error occurred during the compilation of a resource required
to...
|
by: Claudia Fong |
last post by:
In my windows form I have a comboBox and a textBox. When I try to write
something in the
textBox it shows me the error message below:
Attempting managed execution inside OS Loader lock. Do not...
|
by: pvong |
last post by:
VB.NET / ASP.NET
I have a simple test. One simple Formview connected to a datasource. I
have Button1 outside of the Formview. The Formview starts in ReadOnlyMode.
All I want to do is on the...
|
by: dnnddane |
last post by:
Hi All,
I try to create a sample asp.net ajax application in visual studio 2005.
I have 1 textbox, 1 requirefieldvalidator and 1 button. All are in updatepanel.
When I click the button and the...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
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...
|
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,...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |