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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modifier and VB problem 1

Status
Not open for further replies.

bawa63

Vendor
Jun 7, 2004
83
US
I want to add a picture to sales transaction entry window grid for the items. I need to make this picture visible for when certain items are added to an order and invisible for other items in the grid. I check this condition in VB whether this picture is to be shown or not. If i add this as a picture from the toolbox, it has no name and hence i have no reference to it in VB.
I want to add this picture as a local variable and add it to vb so I can make it visible or not. How do i make a picture a local variable. Please advise, thanks.
 
Further to above problem, I added a text object to the grid defining it as a local variable. I keep this blank but when i try to populate it from VBA, it gives me this error

"Unsafe Operation. An attemp was made to set a value which violates the application's business logic. This operation could compromise the integrity of the application"

Any idea why this occurs? How can i get vba to set this text variable to a certain value depending on the item number? Please advise. Thanks.
 
The field must be editable for you to be able to populate it. Also I don't think Scrolling windows like Text fields, can it be a string field instead?

Finally, for your picture, create a local field of table visual switch and add one or more pictures. Set it to 0 for no pic or 1, 2, 3... etc for added pictures.

David Musgrave [MSFT]
Senior Development Consultant
Escalation Engineer
MBS Support - Asia Pacific

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.
 
Hii David, I added a local variable of type visual switch. Added a picture to it in modifier. When I open the form in GP, the switch shows but the picture does not show on it. Also I added this switch to VB. When i reference it, there is no reference to picture method. How do i set it to 0 or 1 as you suggested. What am I doing wrong? please advise. Thanks
 
In addition to above post, The switch is also not visible unless mouse is passed over it and clicked. How do I make it visible when the form loads rather than clicking over the general area to see it. Also when the form loads, how can i scroll thru the whole grid and set this visual switch with a certain value depending on the value of itemnumber. for eg, if someone opens an order already entered into the system which has say 5 items, i want to go thru the grid and scroll thru the 5 items and set values for the switch accordingly. Please bear with me as I'm new to this and the manuals do not give proper details to get all this info. Thanks
 
Use the VBA Line populate event and just set the value to 0, 1, 2 as required.

<Field Name>.Value = 0

No picture method is needed, when you set it's value it gets set.

I would also suggest changing the Visual switch to be Editable = false.

Use the VBA code to set its value, don't click on the field itself.

David Musgrave [MSFT]
Senior Development Consultant
Escalation Engineer
MBS Support - Asia Pacific

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.
 
David, setting the editable to false does not display the switch at all. How do i get the switch to display when the form is loaded and that also without clicking on it. Earlier when editable was true, it wud show only when clicked on, not otherwise.
 
You must at least set it to a value > 0 for it to show anything. 0 means no picture.

David Musgrave [MSFT]
Senior Development Consultant
Escalation Engineer
MBS Support - Asia Pacific

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.
 
David, even after i set it to a value > 0, it doesn't show unless the mouse is passed over it. What should i do to make it show as soon as i set the value.
 
David, let's start over again. This is what i want to do. I have some items that are hazardous and others which are not. I have stored this value in the user defined 1 of the item's options. What i want to do is when a user enters an item which is hazardous, i want a visual clue to be given to the user that is it hazardous. Also after this order is saved and when it is retrieved, i want that visual clue to appear too. What is the best way to do it using modifier and VBA?

I have the code done for checking the user defined 1 of the item entered. I have put this code in itemnumber.lostfocus property. I know this is not the best place to put it in but i don't know the best place to put it too.
PS the visual switch i have added earlier in added next to itemnmbr field in the grid and not the main window because i want this visual next to every item.

Thanks a ton for ur help.
 
You should use the Grid_LinePopulate and the ItemNumber_AfterUserChanged events.

Set the Visual switch in the grid to zero for no picture and to 1 for your hazardous visual cue.

David Musgrave [MSFT]
Senior Development Consultant
Escalation Engineer
MBS Support - Asia Pacific

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.
 
David, thanks a ton. I added a text and use the events you gave. it works fine. Just one small thing. The font color in the text is black. I want it red. I set it in modifier to be red but it does not show red on the form although it shows red in modifier. Also i cannot set it with VBA. Any ideas what i should do here?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top