Jumat, 29 November 2013

RE: [MS_AccessPros] Formating question

I think you need to move this line:
   Me.[_Site Visit].FontUnderline = False
to just after the first Else.


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim Flag As Integer
Dim k As Date

'Set Occured or Past Status
g = Code   'project code for test tracking
Flag = Site_Visit_Occured
If Me.Site_Visit_Occured Then
    Me.[_Site Visit].FontUnderline = True
Else
    Me.[_Site Visit].FontUnderline = False
    If Me.[_Site Visit] <> "N/A" Then
        k = Me.[_Site Visit]
        If k < Date Then
            Me.[_Site Visit].FontBold = True
        Else
            Me.[_Site Visit].FontBold = False
        End If
    End If
End If

End Sub

Duane Hookom MVP
MS Access

________________________________
> To: MS_Access_Professionals@yahoogroups.com
> From: JohnV@msn.com
> Date: Fri, 29 Nov 2013 21:30:46 +0100
> Subject: RE: [MS_AccessPros] Formating question
>
>
>
>
> Bryan-
>
>
>
> You should be able to single step through the code (open the Debug
> toolbar to help) to see if it is processing each record individually.
> When you're halted in the code, you can go to the Debug window (CTRL+G)
> to query the key values of the row.
>
>
>
> ?Me.ID
>
>
>
> .. for example.
>
>
>
> John Viescas, Author
>
> Microsoft Access 2010 Inside Out
>
> Microsoft Access 2007 Inside Out
>
> Microsoft Access 2003 Inside Out
>
> Building Microsoft Access Applications
>
> SQL Queries for Mere Mortals
>
> http://www.viescas.com/
>
> (Paris, France)
>
>
>
>
>
>
>
> From: MS_Access_Professionals@yahoogroups.com
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Bryan
> Sent: Friday, November 29, 2013 9:02 PM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: RE: [MS_AccessPros] Formating question
>
>
>
>
>
>
> John,
>
> I removed the conditional formatting to make sure it was not interfering.
>
>
>
> I wanted to move it to the code for 2 reasons, 1) learning process, 2)
> keep all the formatting codes in one place – there are other changes
> done (mainly background color) to the row based upon specific
> conditions.
>
>
>
> The only thing that I can think of is the row that seems to control the
> underlining has a lower ID – unless the original designer hid something
> on the form itself…
>
>
>
> Thanks,
>
> B
>
>
>
> From:
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals@yahoogroups.com>
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of John
> Viescas
> Sent: Friday, November 29, 2013 1:41 PM
> To:
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals@yahoogroups.com>
> Subject: RE: [MS_AccessPros] Formating question
>
>
>
>
>
> Bryan-
>
>
>
> If you still have Conditional Formatting active, that could be
> interfering. If it was working in Conditional Formatting, why do you
> want to try to do it in code?
>
>
>
> John Viescas, Author
>
> Microsoft Access 2010 Inside Out
>
> Microsoft Access 2007 Inside Out
>
> Microsoft Access 2003 Inside Out
>
> Building Microsoft Access Applications
>
> SQL Queries for Mere Mortals
>
> http://www.viescas.com/
>
> (Paris, France)
>
>
>
>
>
>
>
> From:
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals@yahoogroups.com>
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Bryan
> Sent: Friday, November 29, 2013 6:13 PM
> To:
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals@yahoogroups.com>
> Subject: RE: [MS_AccessPros] Formating question
>
>
>
>
>
>
>
> John,
>
> I have a break in the code on the "If Me.Site_Visit_Occured Then" line
>
>
>
> I can see that the Flag follows the first record, not the individual records.
>
>
>
> It's bugging me cause I cannot find where the field gets "locked" at.
>
>
>
> Could there be something on the design page that is controlling it?
>
>
>
> Thanks,
>
> B
>
>
>
> From:
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals@yahoogroups.com>
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of John
> Viescas
> Sent: Friday, November 29, 2013 11:47 AM
> To:
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals@yahoogroups.com>
> Subject: RE: [MS_AccessPros] Formating question
>
>
>
>
>
> Bryan-
>
>
>
> The Format event should fire for each record in the Detail section, so
> each record should be handled individually. You could try putting a
> halt in your code at the beginning, then switch to Print Preview and
> single step through the code to see what it is actually doing.
>
>
>
> By the way, I prefer using variable names that make it clear the
> declared data type. I would have used:
>
>
>
> Dim intFlag As Integer, datK As Date
>
>
>
> This isn't too important for a short bit of code, but it sure helps
> when you've written a long procedure and encounter on the 50th line or
> so something like:
>
>
>
> k = Me.[_Site Visit]
>
>
>
> It's much clearer that you're dealing with a date value if it reads:
>
>
>
> datK = Me.[_Site Visit]
>
>
>
> John Viescas, Author
>
> Microsoft Access 2010 Inside Out
>
> Microsoft Access 2007 Inside Out
>
> Microsoft Access 2003 Inside Out
>
> Building Microsoft Access Applications
>
> SQL Queries for Mere Mortals
>
> http://www.viescas.com/
>
> (Paris, France)
>
>
>
>
>
>
>
> From:
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals@yahoogroups.com>
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Bryan
> Sent: Friday, November 29, 2013 5:27 PM
> To:
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals@yahoogroups.com>
> Subject: [MS_AccessPros] Formating question
>
>
>
>
>
>
>
>
> Hello again…..
>
> I'm now trying to "teach" myself some formatting on a report.
>
> The previous creator of the report used a mix of vba and conditional
> formatting in the report.
>
> Short version:
>
> From the database, we have a project code, a site visit date and a site
> visit occured checkbox
>
> Using conditional formatting:
>
> 1) If the checkbox is checked, then the date is underlined.
>
> 2) If the date is yet to occur, no formatting.
>
> 3) If the date is past the current date, then the date is bold.
>
> In vba I have the bold part working, but the underline is not working.
> The current search query returns 2 records.
>
> What is happening is:
>
> 1) When record #1 is checked, both cells are underlined
>
> 2) When only record #2 is checked, no underlining at all
>
> 3) When both records are checked, both cells are underlined
>
> Trying to figure out why record #2 won't underline when it is the only
> one checked?
>
> This is what I have so far –
>
> Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
>
> Dim Flag As Integer
>
> Dim k As Date
>
>
>
> 'Set Occured or Past Status
>
> g = Code 'project code for test tracking
>
> Flag = Site_Visit_Occured
>
> If Me.Site_Visit_Occured Then
>
> Me.[_Site Visit].FontUnderline = True
>
> Else
>
> If Me.[_Site Visit] <> "N/A" Then
>
> k = Me.[_Site Visit]
>
> If k < Date Then
>
> Me.[_Site Visit].FontBold = True
>
> Else
>
> Me.[_Site Visit].FontUnderline = False
>
> Me.[_Site Visit].FontBold = False
>
> End If
>
> End If
>
> End If
>
>
>
> End Sub
>
> Thanks
>
> B
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)

<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
http://info.yahoo.com/legal/us/yahoo/utos/terms/

Tidak ada komentar:

Posting Komentar