Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making a field required? (7.5) 2

Status
Not open for further replies.

Borvik

Programmer
Jan 2, 2002
1,392
US
I don't know if it can be done, but we have a "Manufacturer" field on our "Item Maintenance Options" screen. See screen shot (
I'm constantly telling people we can't properly get the reports they want because people don't fill this field in properly when the item is created. Is there a way to make this field required so that we can be sure that it is filled in?

Thanks.
 
I'm sure in VB it's possible, but failing that, I would subject it to a default value via the item class setup. That way the "non filled in correctly" data shows up in a grouping that you can point to and say "your fault"

You can even be nice to them and create a job script to run once a day/week that would email the user who created the item with a reminder email to go fix it.



-----------
and they wonder why they call it Great Pains!

jaz
 
Ok, I get the default value idea, but how would I determine which user created the item? I would assume there is a field in the database for that, but I'm not seeing it right off the bat.
 
I had a similar problem and had to write a trigger that would update MY table with who updated it --- although that was not for an Item (I needed to know who updated a customer last), but your situation gives me cause to want to put the trigger behind the iv00101 table as well.

of course the pain of having to re-install the trigger on each upgrade far out weighs (in my opinion) not having the information.

just a thought...
 
Ok, trigger seems to be the way to go there - how do I determine (using the trigger) WHO is doing the entering?

I've tried "SELECT user, user_id()" in Query Analyzer, but that just returned "dbo, 1".
 
Ok user worked...

Here's the trigger I used (the Item_Log) table only has the 2 columns in the trigger:
Code:
CREATE TRIGGER Item_Insert 
   ON  IV00101 
   AFTER INSERT
AS 
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for trigger here
	DECLARE @user2ent char(15), @theItem char(51)
	SELECT @user2ent = user
	SELECT @theItem = ITEMNMBR FROM INSERTED
    INSERT INTO Item_Log(ITEMNMBR, USER2ENT) VALUES(@theItem, @user2ent)
END
CREATE TRIGGER Item_Delete 
   ON  IV00101 
   AFTER DELETE
AS 
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for trigger here
    DECLARE @theItem char(51)
	SELECT @theItem = ITEMNMBR FROM DELETED
	DELETE FROM Item_Log WHERE ITEMNMBR = @theItem
END
GO

Thanks for the help guys!
 
I just checked the source code for the IV_Item_Maintenance window and the Save Record script only checks for require fields on the main window (IV_Item_Maintenance) rather than on the entire form. If the check was made on the entire form, the required fields on the accounts and options windows would be checked as well. Which would allow the setting of the field property of Required to true using the modifier to work.

So, based on how the code is written, you would need to use VBA or Dexterity to force this field to be required.

Hope this explains it.

David Musgrave [MSFT]
Senior Development Consultant
Escalation Engineer - Great Plains
Microsoft Dynamics Support - Asia Pacific

Microsoft Dynamics (formerly Microsoft Business Solutions)

Any views contained within are my personal views and
not necessarily Microsoft Business Solutions policy.
This posting is provided "AS IS" with no warranties,
and confers no rights.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top