473,394 Members | 1,752 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.

Compare two txtbox vba Access

if txtbox1.value = txtbox2.value then
msgbox "Equel" Else
msgbox "Unequel"
end if


How to make this work in vba access?
Dec 19 '16 #1

✓ answered by Luk3r

There are plenty of demonstrations online for what you're trying to do. You must first create a procedure, whether that is a procedure to call or say, clicking a button, you must have a procedure. Something like this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Test()
  2.     If TxtBox1.Value = TxtBox2.Value Then
  3.         MsgBox "Equal"
  4.     Else
  5.         MsgBox "Not Equal"
  6.     End If
  7. End Sub

7 1122
Luk3r
300 256MB
Your solution should work, with the possible exception of the location of "Else":

Expand|Select|Wrap|Line Numbers
  1. If TxtBox1.Value = TxtBox2.Value Then
  2. MsgBox "Equal"
  3. Else
  4. MsgBox "Not Equal"
  5. End If
Dec 19 '16 #2
I still godt error when i try this code in the button. The expression on clicks that you have selected as the event property, causing the error Outside of a procedure invalid. What do i do wrong?
Dec 20 '16 #3
Luk3r
300 256MB
Can you share all of your code? That error is because you're writing code outside of a procedure, as stated, or you're missing a fine detail (misspelled resume/exit).
Dec 20 '16 #4
I have no more code than you see when I do not know enough about vba to know what it takes to get the code I have posted to work. I have only two textboxes who work like this, I click the button, it comparing values. I do not know how proseduren should be written. I've tried long to find answers to this challenge.
Dec 21 '16 #5
But i will use it in access 2013 database.
Dec 21 '16 #6
Luk3r
300 256MB
There are plenty of demonstrations online for what you're trying to do. You must first create a procedure, whether that is a procedure to call or say, clicking a button, you must have a procedure. Something like this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Test()
  2.     If TxtBox1.Value = TxtBox2.Value Then
  3.         MsgBox "Equal"
  4.     Else
  5.         MsgBox "Not Equal"
  6.     End If
  7. End Sub
Dec 21 '16 #7
Thanks a lot!!! It realy helped me here! Wish you a Merry Christmas!!!
Dec 22 '16 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Rosco | last post by:
Does anyone have a good URL or info whre Oracle and Access are compared to one another in performance, security, cost etc. Before you jump on me I know Oracle is a Cadillac compared to Access the...
7
by: Ruben Baumann | last post by:
Just wondered if anyone has had occasion to use, or does use, FileMaker, or Raining Data's Omnis, or Alpha5's software, and how they compare with Access? Ruben
22
by: Jordan S. | last post by:
SQL Server will be used as the back-end database to a non trivial client application. In question is the choice of client application: I need to be able to speak intelligently about when one...
2
by: Michael Bialowas | last post by:
Hello all, I have been searching the net endlessly and found this ng, so I thought I would give a try. Anyways, I have a few problems I am trying to implement a combo box which presently contains...
4
by: neb | last post by:
Hi all, Does anybody know if there is anything like Access that is xml powered? Having MS Access in mind, I dream of an engine that will store the xml document, and their schema, and enable...
1
by: TitanXIII | last post by:
made a little program in access that allows me to add members to a distribution list through access. I only use 4 field being 3 textbox and a command button 1 txtbox for a name 1 txtbox for...
1
by: neelaseenu | last post by:
Hi there Can some one help me with this issue. I have 2 text fields which user selects the date from calender control. Now i want to retreive data from table which falls in the range of these 2 text...
1
by: vinci08 | last post by:
I was surfing for Access DB - Visual Basic combination. I visited wbcsoftwarelab blogspot. When I visited the site, I found Access-DB compare - Tool to compare two Access Databases for free...
7
by: DefaultWorkgroup | last post by:
Good Morning Ladies and Gentleman. My question is in MS Access 2000 (I know is old, is all I have) I’m basically a Newbie in this posting of new threads and in the MS Access as well. I...
1
by: usha2 | last post by:
Hellow Sir, I am working with Active Directory. I have some data in my access database. i need to compare these data with Active directory's sAMAccountname. I used the SQL statement to pull AD...
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: 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
0
BarryA
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...
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
Oralloy
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,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.