| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Data Row Problem
All,
Attempting something I have not tried before. Have the form shown at: http://imagebin.ca/view/Rv5YCvvc.html Need to accomplish the following on the subform: 1. Change color, row by row, for different status values, 2. Change value, row by row, from either drop-down or pop-up. I actually only need to change/manage color and value in the "Status" column. I can get the right values, on double-click, but when I attempt to set them all the rows set, not the individual one. I know this is needing an index for the row, but since I've not done this before, do not know what index I am looking for. Also I do not know what I should be searching for, so not getting and online help. URLs to HOWTOs please. Thanks! OMR Last edited by OldManRiver : October 26th, 2009 at 11:44 AM. |
|
#2
|
|||
|
|||
|
Conditional Formatting - Not the Answer
All,
I appreciate the inputs on condition formatting, but it is limited to just 3 values, where I have 9. What I need is for the functionality of conditional formatting in vba so I can fill in the row, setting the color as it sets, then change the column and reset the color, and finally save all this. Notice I am not using the Nav Bars, etc, so even though the subform is a bound form, this is readonly to the screen and save is handled seperate with a button, as there are 5 tables involved, which are outside of a pre-defined relationship. Thanks! OMR |
|
#3
|
|||
|
|||
|
Examples
All,
So after following all the links and much more research I was either directed to or found 5 examples of how I should do this, which are in the file at: http://filebin.ca/onqyan/CondFormat.zip File0 ==> Is one with Bitmap Image and works, but cannot apply to my program as somehow this one gets a value for the combobox field and mine does not. With all my efforts I can not duplicate the ability to get a value in my field, nor is there any detail on how to set the color bitmaps in the database, which is critical. File1,2 ==> Of no value at all. File3 ==> Coloring and code are interesting but has no combobox so not sure of any value. File4 ==> Good code but not Continuous Form so not sure of the value. Still searching and not finding, so may have to write this one my self. The sites at: http://msdn.microsoft.com/en-us/library/aa139965%28office.10%29.aspx http://blogs.msdn.com/frice/archive/2004/06/08/151178.aspx http://www.experts-exchange.com/Microsoft/Development/MS_Access/Access_Forms/Q_22940240.html all suggest this code to set up conditional formatting object values: Code:
Sub TKT_DInit()
Dim objCond As FormatConditions
' Set objCond = TargetForm.[cboxHST].FormatConditions.Add(acExpression, , (TargetForm![cboxHST].Value = "Entered"))
' Set objCond = TargetForm.[cboxHST].FormatConditions.Add(acExpression, , (TargetForm![cboxHST].Value = "Approved"))
' Set objCond = TargetForm.[cboxHST].FormatConditions.Add(acExpression, , (TargetForm![cboxHST].Value = "Deficiencies"))
' Set objCond = TargetForm.[cboxHST].FormatConditions.Add(acExpression, , (TargetForm![cboxHST].Value = "Client Approved"))
' Set objCond = TargetForm.[cboxHST].FormatConditions.Add(acExpression, , (TargetForm![cboxHST].Value = "Invoice Hold"))
' Set objCond = TargetForm.[cboxHST].FormatConditions.Add(acExpression, , (TargetForm![cboxHST].Value = "Billed"))
' Set objCond = TargetForm.[cboxHST].FormatConditions.Add(acExpression, , (TargetForm![cboxHST].Value = "Contested"))
' Set objCond = TargetForm.[cboxHST].FormatConditions.Add(acExpression, , (TargetForm![cboxHST].Value = "Re-Invoiced"))
' Set objCond = TargetForm.[cboxHST].FormatConditions.Add(acExpression, , (TargetForm![cboxHST].Value = "Paid"))
End Sub
But as you see I had to comment them out as their syntax is incorrect and they constantly give errors. I did find the code: Code:
Function GetLineNumber(f As Form, KeyName As String, KeyValue)
Dim rs As Recordset
Dim CountLines
On Error GoTo Err_GetLineNumber
Set rs = f.RecordsetClone
' Find the current record.
Select Case rs.Fields(KeyName).Type
' Find using numeric data type key value?
Case DB_INTEGER, DB_LONG, DB_CURRENCY, DB_SINGLE, _
DB_DOUBLE, DB_BYTE
rs.FindFirst "[" & KeyName & "] = " & KeyValue
' Find using date data type key value?
Case DB_DATE
rs.FindFirst "[" & KeyName & "] = #" & KeyValue & "#"
' Find using text data type key value?
Case DB_TEXT
rs.FindFirst "[" & KeyName & "] = '" & KeyValue & "'"
Case Else
MsgBox "ERROR: Invalid key field data type!"
Exit Function
End Select
' Loop backward, counting the lines.
Do Until rs.BOF
CountLines = CountLines + 1
rs.MovePrevious
Loop
Bye_GetLineNumber:
' Return the result.
GetLineNumber = CountLines
Exit Function
Err_GetLineNumber:
CountLines = 0
Resume Bye_GetLineNumber
End Function
from File3 interesting as it what I knew is needed to track the ROWindex for each row in the continuous form, but still tryng to figure out the exact application. I also saw some this forum thread: http://www.mdbmakers.com/forums/showthread.php?t=20445 discussing this and the one guy, who liked concise code, stripped this down to about 3 lines of active code. Anyway I now have two forms that need this, so really hunting for it. May have to open Fields on my main form, and assign/save values from their, if I can not get the comboboxes working right. Kinda under pressure as I have to deliver at least one of my forms in the morning. OMR |
![]() |
| Viewing: Tutorialized Forums > Databases > MS Access > Data Row Problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|