A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

HELP!!! Validation rule



 
 
Thread Tools Display Modes
  #1  
Old May 29th, 2004, 11:37 PM
Chris
external usenet poster
 
Posts: n/a
Default HELP!!! Validation rule

I have to introduce in a table some data, using a form with contrtols: combo
boxes and text boxes. The fields need to follow some VALIDATION RULES, and
to display the VALIDATION TEXT as the error message.
The validation rules must to fields from a query, because the that table is
used to extract items from a storage and it musn't contain data that was not
entered (that query representing the state of the storage at that moment).
How can I do this thing?
Please, help me! I'm stucked.



  #2  
Old May 31st, 2004, 03:09 AM
Chris
external usenet poster
 
Posts: n/a
Default HELP!!! Validation rule



I have to introduce in a table some data, using a form with contrtols: combo
boxes and text boxes. The fields need to follow some VALIDATION RULES, and
to display the VALIDATION TEXT as the error message.
The validation rules must REFER to fields from a query, because the that
table is
used to extract items from a storage and it musn't contain data that was not
entered (that query representing the state of the storage at that moment).
How can I do this thing?
Please, help me! I'm stucked.


  #3  
Old May 31st, 2004, 01:45 PM
John Nurick
external usenet poster
 
Posts: n/a
Default HELP!!! Validation rule

Hi Chris,

If you're storing your data in a Jet database (an .mdb file) you can't
do this at the table level. Instead, put your validation code in event
procedures of the form and its controls. Typically, validation for a
single field would be in the corresponding control's BeforeUpdate event,
or validation for the entire record in the form's BeforeUpdate event.

On Sun, 30 May 2004 01:37:08 +0300, "Chris" wrote:

I have to introduce in a table some data, using a form with contrtols: combo
boxes and text boxes. The fields need to follow some VALIDATION RULES, and
to display the VALIDATION TEXT as the error message.
The validation rules must to fields from a query, because the that table is
used to extract items from a storage and it musn't contain data that was not
entered (that query representing the state of the storage at that moment).
How can I do this thing?
Please, help me! I'm stucked.



--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
  #4  
Old June 1st, 2004, 08:12 AM
Chris
external usenet poster
 
Posts: n/a
Default HELP!!! Validation rule

I must introduce the data in a table(the table of the exits from a stock)
through a form having the controls :
TextboxATA; cmbbox ID_material; cmbbox ID_dimensions; cmbbox
ID_Quality; Textbox Quantity, cmbbox UM (kg, m, or pieces); Texbox
UnitPrice; cmbbox MonetarUnit; CmbBox ID_order; textbox ProductCode;
Textbox UnitsOfProduct

These record must not contain data not entered. The entered data (totalized
by categories) is represented by the query:

SELECT DISTINCT [stoc1-0].Mat_Code, [stoc1-0].Material,
[stoc1-0].Dimensions, [stoc1-0].Quality, Sum([stoc1-0].[Length(m)]) AS
[SumOfLength(m)], Sum([stoc1-0].[Quantity(kg)]) AS [SumOfQuantity(kg)],
Sum([stoc1-0].[Quantity(pieces)]) AS SumOf[Quantity(pieces)],
[stoc1-0].ID_material, [stoc1-0].ID_Dimensions, [stoc1-0].Cod_Calit,
[stoc1-0].UM, [stoc1-0].UnitPrice, Sum([stoc1-0].[TotalPrice]) AS
[SumOfTotalPrice], [stoc1-0].[Price(euro)],
Sum([stoc1-0].[TotalPrice(euro)]) AS SumOf[TotalPrice(euro)]
FROM [stoc1-0]
GROUP BY [stoc1-0].Material_Code, [stoc1-0].Material, [stoc1-0].Dimensions,
[stoc1-0].Quality, [stoc1-0].ID_material, [stoc1-0].ID_Dimensions,
[stoc1-0].Cod_Calit, [stoc1-0].UM, [stoc1-0].UnitPrice,
[stoc1-0].[Price(euro)]
ORDER BY [stoc1-0].Material, [stoc1-0].Quality, [stoc1-0].Dimensions;

(Mat_code is : Format([id_material];"000") & Format([id_dimensions];"000")
& Format([ID_Quality];"000")

Can you help me ?
How can I validate in this situation the entire record in the BeforeUpdate
event? Or how can it be made for every field?
I would apreciate your help.


"John Nurick" wrote in message
...
Hi Chris,

If you're storing your data in a Jet database (an .mdb file) you can't
do this at the table level. Instead, put your validation code in event
procedures of the form and its controls. Typically, validation for a
single field would be in the corresponding control's BeforeUpdate event,
or validation for the entire record in the form's BeforeUpdate event.

On Sun, 30 May 2004 01:37:08 +0300, "Chris" wrote:

I have to introduce in a table some data, using a form with contrtols:

combo
boxes and text boxes. The fields need to follow some VALIDATION RULES,

and
to display the VALIDATION TEXT as the error message.
The validation rules must to fields from a query, because the that table

is
used to extract items from a storage and it musn't contain data that was

not
entered (that query representing the state of the storage at that

moment).
How can I do this thing?
Please, help me! I'm stucked.



--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.



  #5  
Old June 1st, 2004, 01:11 PM
bracke eric
external usenet poster
 
Posts: n/a
Default HELP!!! Validation rule

Chris,

You can create a validation rule per control on a form.
On the form, select a control and in the properties window, select the DATA tab.

If you want to validate data on a calculated field, you will need to create a procedure on the Form BeforeUpdate Event:
Let assume that the SumOfTotalPrice field must be validated:

Private Sub Form_BeforeUpdate(Cancel As Integer)

'If SumOfTotalPrice must be 5:
If Me.SumOfTotalPrice = 5 Then
MsgBox "SumOfTotalPrice must be greater than 5..."
'Set cancel to true so no update to the table
Cancel = True
End If


End Sub

Eric

"Chris" wrote in message ...
I must introduce the data in a table(the table of the exits from a stock)
through a form having the controls :
TextboxATA; cmbbox ID_material; cmbbox ID_dimensions; cmbbox
ID_Quality; Textbox Quantity, cmbbox UM (kg, m, or pieces); Texbox
UnitPrice; cmbbox MonetarUnit; CmbBox ID_order; textbox ProductCode;
Textbox UnitsOfProduct

These record must not contain data not entered. The entered data (totalized
by categories) is represented by the query:

SELECT DISTINCT [stoc1-0].Mat_Code, [stoc1-0].Material,
[stoc1-0].Dimensions, [stoc1-0].Quality, Sum([stoc1-0].[Length(m)]) AS
[SumOfLength(m)], Sum([stoc1-0].[Quantity(kg)]) AS [SumOfQuantity(kg)],
Sum([stoc1-0].[Quantity(pieces)]) AS SumOf[Quantity(pieces)],
[stoc1-0].ID_material, [stoc1-0].ID_Dimensions, [stoc1-0].Cod_Calit,
[stoc1-0].UM, [stoc1-0].UnitPrice, Sum([stoc1-0].[TotalPrice]) AS
[SumOfTotalPrice], [stoc1-0].[Price(euro)],
Sum([stoc1-0].[TotalPrice(euro)]) AS SumOf[TotalPrice(euro)]
FROM [stoc1-0]
GROUP BY [stoc1-0].Material_Code, [stoc1-0].Material, [stoc1-0].Dimensions,
[stoc1-0].Quality, [stoc1-0].ID_material, [stoc1-0].ID_Dimensions,
[stoc1-0].Cod_Calit, [stoc1-0].UM, [stoc1-0].UnitPrice,
[stoc1-0].[Price(euro)]
ORDER BY [stoc1-0].Material, [stoc1-0].Quality, [stoc1-0].Dimensions;

(Mat_code is : Format([id_material];"000") & Format([id_dimensions];"000")
& Format([ID_Quality];"000")

Can you help me ?
How can I validate in this situation the entire record in the BeforeUpdate
event? Or how can it be made for every field?
I would apreciate your help.


"John Nurick" wrote in message
...
Hi Chris,

If you're storing your data in a Jet database (an .mdb file) you can't
do this at the table level. Instead, put your validation code in event
procedures of the form and its controls. Typically, validation for a
single field would be in the corresponding control's BeforeUpdate event,
or validation for the entire record in the form's BeforeUpdate event.

On Sun, 30 May 2004 01:37:08 +0300, "Chris" wrote:

I have to introduce in a table some data, using a form with contrtols:

combo
boxes and text boxes. The fields need to follow some VALIDATION RULES,

and
to display the VALIDATION TEXT as the error message.
The validation rules must to fields from a query, because the that table

is
used to extract items from a storage and it musn't contain data that was

not
entered (that query representing the state of the storage at that

moment).
How can I do this thing?
Please, help me! I'm stucked.



--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.