473,666 Members | 2,517 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inserting text in an Access DB Validation Rule problem

1 New Member
Hi guys.



I have an Access DB that has a Course table with a primery key CourseSignature which has a validation rule

Like "[A-Z][A-Z][A-Z][A-Z]###". For example CSCB343. When I try to enter a value in the DB with



OleDbCommand insertCommand = new OleDbCommand();

insertCommand.C ommandText = "INSERT INTO Course(CourseSi gnature, CourseName, Credits) VALUES('" + signature + "', '" + name + "', " + credits + ")";

insertCommand.C onnection = conn.getOleConn ();

insertCommand.E xecuteNonQuery( );



it gives me an exception that the CourseSignuter is not in the format Like "[A-Z][A-Z][A-Z][A-Z]###". Why!!?!
Feb 10 '08 #1
1 1014
kenobewan
4,871 Recognized Expert Specialist
Hi guys.



I have an Access DB that has a Course table with a primery key CourseSignature which has a validation rule

Like "[A-Z][A-Z][A-Z][A-Z]###". For example CSCB343. When I try to enter a value in the DB with



OleDbCommand insertCommand = new OleDbCommand();

insertCommand.C ommandText = "INSERT INTO Course(CourseSi gnature, CourseName, Credits) VALUES('" + signature + "', '" + name + "', " + credits + ")";

insertCommand.C onnection = conn.getOleConn ();

insertCommand.E xecuteNonQuery( );



it gives me an exception that the CourseSignuter is not in the format Like "[A-Z][A-Z][A-Z][A-Z]###". Why!!?!
I thought numbers were [0-9] and # used for comments. HTH.
Feb 11 '08 #2

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

Similar topics

21
3907
by: Stefan Richter | last post by:
Hi, after coding for days on stupid form validations - Like: strings (min / max length), numbers(min / max value), money(min / max value), postcodes(min / max value), telefon numbers, email adresses and so on. I thought it might be a better way to programm an automated, dynamic form validation that works for all kinds of fields, shows the necessary error messages and highlights the coresponding form fields.
2
2683
by: Joey P | last post by:
Hi all, I am doing a project for university whereby i have to implement a simple database related to a frozen foods company. I am having some trouble though creating a validation rule for one of my fields. I have a table called "Product" and two of the fields included in this table are "Cost Price" and "Retail Price". I need to create a validation rule so that the Cost Price is always less than the Retail Price. I have tried...
0
298
by: Mathew Hill | last post by:
I am a beginner to the more technical aspects of Microsoft Access (2000) and was wondering if any one can help? I have a field in a table called: ADMIN NUMBER This field should have 4 characters and ONLY NUMBERS should be inputted. Does anyone know what the validation rule should be for this field?
7
10772
by: Bonnie R | last post by:
Hello! I am writing VBA code in Access 97 to import an Excel 2000 Spreadsheet. I had hoped to do this using ODBC, but that was not to be, for who knows what reason. The problem is that I import the excel file into a table in Access that I name X. Then I run an append query to import the data into another table. I get an error message that says it "can't append all the records" due
1
2549
by: cga1982 | last post by:
I have a text box (for a password) with a validation rule that checks this password against another text box on the form and either lets you continue or tells you that the password is incorrect and that you have to try again. The problem is that I can just tab right through this text box control. If I type something in the text box it then does make the validation check but I can still just tab past it without entering a thing. Any ideas...
3
2024
by: BrianB830 | last post by:
Hello all, I have a quick question regarding an MS Access database I'm creating. In the entity "ORDER", I have the attributes "Order Date" and "Delivery Date". I need to create a validation rule here. The delivery date must come after the order date. Would anyone be able/willing to help?
9
3109
by: sellcraig | last post by:
Microsoft access 2 tables table "data main" contains a field called "code" table "ddw1" is created from a make table query of "data main" Goal- the data in "code" field in needs to be inserted into a standard web address in the table (the filed name is link) in ddw1 Example address ---
10
2935
by: canam | last post by:
Hi: I hope someone can help me. Is there a way to add a password to a particular field in the event that the validation rule must be over written? I've created an input form in a database that I'm creating. One field in particular has an input validation of " <=125000 " with a warning message that states "THE NET WEIGHT MUST BE LESS THAN OR EQUAL TO 125,000 lbs OR VALIDATION IS REQUIRED." The user would like the ability to...
13
3041
by: imnewtoaccess | last post by:
Hi, I am getting errors while inserting records in one table from another. These are the structures of two tables : file51tm_new RecordType Text
0
8454
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8362
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
8878
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
8644
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...
1
6200
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5671
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
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
2012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.