MS Access details form
Posted on 2004-04-29
I have an acces form,with a subform to display the details.
In the subform i hava command button to open anothe form to enter notes.
There willbe multiple records for thr details.
so i made the default view to Continuous Forms for the sub form
My proble is how do i set the color of the command button,( which opens the notes editor)
when there is any notes are available?If not, set it to default color?
here is the code i wrote in Form load
Dim db As Database, objRs As Recordset
Set db = CurrentDb()
Dim sql As String
sql = "select * from tblCustOrderDetails where JobNumber='" & Me![JobNumber] & "' "
Set objRs = db.OpenRecordset(sql)
Do Until objRs.EOF
If (IsNull(objRs("TextNotes"))) Or (Len(objRs("TextNotes")) = 0) Then
' Me![Notes].ForeColor = vbBlue
' Me![Notes].ForeColor = 255
The problem is that it set the color of all the button depending up on the last record status.
Because the NAME is same for all the command buttons in the details screen.
Any help will be appreciated