Prev: Teste
Next: Hide System Fileds in table
From: jubiiab via AccessMonster.com on 19 Mar 2010 10:00 I have form with a subform. On the mainform I have a history of all kind of machine parts. In the subform I have information of a supplier. Some Machine ID's have more then one supplier attached. The subform look like this if I have more then one supplier attached to a machine (only showing few fields and I using continues form view): [SupplierID] [SupName] [SupMachineID] [SupMachineName] [UseSupplier] 1 Test1 54564763 MachineTest [_] (checkbox) 2 Test2 9788979 MachineTest2 [x] (checkbox) 3 Test3 9788979 MachineTest3 [_] (checkbox) I am using this code in the subform: Private Sub Form_Current() If Me.UseSupplier = True Then Me.SupName.ForeColor = vbGreen Me.Supname.FontBold = True Else Me.Supname.ForeColor = vbBlack End If End Sub My problem is when I have a checkmark in the checkbox I get all [SupName] green. I just want to have (like in the example above) [SubName]=Test2 to become green. What am I doing wrong? Sorry about my English. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201003/1
From: jubiiab via AccessMonster.com on 19 Mar 2010 10:02 The subform should look like this: [SupplierID] [SupName] [SupMachineID] [SupMachineName] [UseSupplier] 1 Test1 54564763 MachineTest [_] (checkbox) 2 Test2 9788979 MachineTest2 [x] (checkbox) 3 Test3 9788979 MachineTest3 [_] (checkbox) -- Message posted via http://www.accessmonster.com
From: Linq Adams via AccessMonster.com on 19 Mar 2010 10:21 If the subform is in Datasheet or Continuous View, as most are, you cannot do this kind of formatting thru code in the Form_Current event. You'll have to use the Conditional Formatting from the Format Menu. -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201003/1
From: jubiiab via AccessMonster.com on 19 Mar 2010 10:22 what do i write in Conditonal formatting?? Can you give me an example of code? Linq Adams wrote: >If the subform is in Datasheet or Continuous View, as most are, you cannot do >this kind of formatting thru code in the Form_Current event. You'll have to >use the Conditional Formatting from the Format Menu. > -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201003/1
From: Linq Adams via AccessMonster.com on 19 Mar 2010 10:29
Sorry, meant to give you a step-by-step: Goto Format - Conditional Formatting Under Condition select "Expression Is" Then in the next box enter [UseSupplier] = -1 Now simply use the icons to set the Forecolor you want and Bold it. Now click on OK You should be set. BTW, the only kind of formatting you can do on these types of forms, using code in the Form_Current event, is to Lock/Unlock and Enable/Disable controls. -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201003/1 |