473,811 Members | 4,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access Form Null Checking with Linked SQL / ODBC Table

I have a access form that is connected to linked sql table via odbc.
I have some fields that I dont want to allow nulls when data is
entered via the form. I can set the null checking on the SQL server
database but the ODBC error tha tis returned is not very polite to the
user since it mentions the sql field not the nice label.

Is there a way for me to modify this error or put the check in access?
Nov 13 '05 #1
4 2562
Try using the Form_BeforeUpda te Event to validate the data before actual
saving to the SQL Server.

--
HTH
Van T. Dinh
MVP (Access)


"Rich" <td*******@yaho o.com> wrote in message
news:22******** *************** ***@posting.goo gle.com...
I have a access form that is connected to linked sql table via odbc.
I have some fields that I dont want to allow nulls when data is
entered via the form. I can set the null checking on the SQL server
database but the ODBC error tha tis returned is not very polite to the
user since it mentions the sql field not the nice label.

Is there a way for me to modify this error or put the check in access?

Nov 13 '05 #2
This leads me to another question. What is the syntax frequired for
the before event? I searched around and found some validation code.
It has an It statment and msgbox command to post a message if the
validation fales however access doesnt like that code. It says that
the msgbox command has bad syntax.

What is the proper syntax for the validation event?
"Van T. Dinh" <Va***********@ discussions.mic rosoft.com> wrote in message news:<e9******* ******@TK2MSFTN GP14.phx.gbl>.. .
Try using the Form_BeforeUpda te Event to validate the data before actual
saving to the SQL Server.

--
HTH
Van T. Dinh
MVP (Access)


"Rich" <td*******@yaho o.com> wrote in message
news:22******** *************** ***@posting.goo gle.com...
I have a access form that is connected to linked sql table via odbc.
I have some fields that I dont want to allow nulls when data is
entered via the form. I can set the null checking on the SQL server
database but the ODBC error tha tis returned is not very polite to the
user since it mentions the sql field not the nice label.

Is there a way for me to modify this error or put the check in access?

Nov 13 '05 #3
If you are talking about the BeforeUpdate Event, it is an Event Procedure
normally written in VBA code. Check Access VB Help on the BeforeUpdate
Event / Event Procedure. I think there are sample code in the Help topic.

If you are asking about the MsgBox statement, see Access VB Help on MsgBox.

In fact for syntax questions, you should always check Access Help first and
try rather than asking the newsgroups. If you can't get it to work after
checking Help, post the codes of your attempts with your question.

--
HTH
Van T. Dinh
MVP (Access)


"Rich" <td*******@yaho o.com> wrote in message
news:22******** *************** ***@posting.goo gle.com...
This leads me to another question. What is the syntax frequired for
the before event? I searched around and found some validation code.
It has an It statment and msgbox command to post a message if the
validation fales however access doesnt like that code. It says that
the msgbox command has bad syntax.

What is the proper syntax for the validation event?

Nov 13 '05 #4
You might as well just code the solution....

I put in the forms before update:

Cancel = MyVerify
And, my code for MyVerify is:
Private Function MyVerify() As Boolean

Dim colFields As New Collection

MyVerify = False

colFields.Add "Description,De scription"
colFields.Add "City,City"
colFields.Add "cboProvince,Pr ovince"
colFields.Add "StartDate,Star t date"
colFields.Add "EndDate,en d date"
colFields.Add "AccountNo,Acco unt number"

MyVerify = vfields(colFiel ds)
End Function

Private Function vfields(colFiel ds As Collection) As Boolean

Dim strErrorText As String
Dim strControl As String
Dim i As Integer

vfields = False

For i = 1 To colFields.Count
strControl = Split(colFields (i), ",")(0)
strErrorText = Split(colFields (i), ",")(1)
If IsNull(Me(strCo ntrol)) = True Then

MsgBox strErrorText & " is required", vbExclamation, AppName
Me(strControl). SetFocus
vfields = True
Exit Function
End If
Next i
End Function

Eg:
colFields.Add "AccountNo,Acco unt number"

The first part is the control on the screen that we want to validate, and
the 2nd part of the custom "text" message that the user will get:

I paste the above into most screens, and thus I don't have to write a bunch
of code for each control that I want as requited. If the control is null,
then you get a error message, the cursor is also placed on the actual
control that is empty....
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl************* ****@msn.com
http://www.attcanada.net/~kallal.msn
Nov 13 '05 #5

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

Similar topics

1
2626
by: E. Zorn | last post by:
Hi, i use Access as a frontend via ODBC to an Linux-based postgresql. I have a problem in a form where I use a lot of subforms. In some cases ( i couldn't detect when - but I really try to) the form and Access hangs. The only way to close the form is to close Access via "cross" (upper right corner). If I try then to view once again the form I get the following error message:
0
1827
by: LesM | last post by:
This is a change of behaviour between Access 2000 SP3 and Access 2002 SP3. I have Progress table that is linked via ODBC into Access using OpenLink Lite for Progress 9.0b. For over a year, using Access 2000 under Win98, I have been running a Make Table or Append query against this ODBC table and producing an extracted Access table. Any fields that are NULL on the source ODBC table show as NULL on the output table. The query also has an...
49
14366
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The application is relatively big: around 200 tables, 200 forms and sub-forms, 150 queries and 150 repports, 5GB of data (SQL Server 2000), 40 users. I'm wondering what are the disadvantages of using Access as front-end? Other that it's not...
6
2808
by: fumanchu | last post by:
I've got to let end users (really just one person) load billing batch files into a third party app table. They need to specify the billing cycle name, the batch name, and the input file name and then I can use these values to execute a SQL Server stored procedure to load them into the batch table from the input file (the stored procedure uses Dynamic SQL to Bulk Insert the file to a temp table then processes it into the final table.) My...
10
3575
by: Eric E | last post by:
Hi all, I am using an Access client linked to a PG 7.4 server via ODBC. I have a stored proc on the server that inserts rows into a table.particular table, accomplished via an INSERT within the body of the stored proc. The procedure does not explicitly commit this data, as no transactions are invoked. The problem is that Access will not modify these records via table or form view, giving its generic "Write conflict: another user has...
52
10009
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server 2005, and, since he already has licenses for Office Pro 2002, he wants to upgrade to that. I've been saying that we need to upgrade to Access 2003, not 2002, even if Office is kept at 2002. We are also looking to do a fair amount of...
2
4243
by: egoldthwait | last post by:
I need to convert a 17mb access 2000 db to Oracle and house it in a Citrix farm. The issue: we have never converted an Access Db to Oracle but can probably use Oracle's Workbench to assist with this. Also - the citrix folks do not want us to keep the FE in Access as the queries and other activities consume a lot of power. The users will be in 3 different offices across the globe all accessing the 1 Oracle DB in Citrix. Does anyone have...
6
6270
by: onnodb | last post by:
Hi all, While working on an Access UI to a MySQL database (which should be a reasonable, low-cost, flexible interface to the DB, better than web-based, much less costly than a full-fledged .NET app or so.... is it?), I tried measuring the bandwith consumed by the Access/MyODBC/MySQL link, which came out to be, er, quite high. I fancied it would be interesting to look at the queries Access throws at MySQL through the ODBC link, so I...
16
9193
by: network-admin | last post by:
We have Problems with Access query on Oracle 10g Database with ODBC Connection. The Query_1 is such as select * from xtable where ycolumn <"S" Result = ODBC Faild ----------------------------------------------------
0
9604
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10379
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10127
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9201
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5552
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4336
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.