Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access Continious Form  : Highlight Current record / Highlight row while creating new record

Posted on 2013-01-13
5
Medium Priority
?
1,355 Views
Last Modified: 2013-01-14
I am using a Microsoft Access 2010 continuous form.

 When a user decides to create a new record in a continuous form, I would like to highlight the row that he is entering data into.  Remember,  the record does not yet exist in the underlying table.

This ties into a question about highlighting the current record.  It is relevant and ended prematurely.

On part 1,  the experts here were able to help me with highlighting the current row.   The solution is elegant.   Please see Access Highlight Current Record -- Nice and easy for a simple and effective way of highlighting the current record.

The solution was almost perfect,  except that when the user enters data in a new record,  the behaviour of the highlighting changed.  I would prefer consistency

The perfect solution would be to only highlight the row that is being edited for a new record.  The actual result differed.  Please see part 1.

The main contributers to my first question Hnasr and IrogSinta have offered more insights.  

Take it from here....  Experts
0
Comment
Question by:peispud
  • 2
  • 2
5 Comments
 
LVL 29

Accepted Solution

by:
IrogSinta earned 1000 total points
ID: 38772837
Okay, here's my solution which has 2 forms.  One highlights just the new record and the other highlights the new record as well as any record being edited.  

Please be sure to wait for the other experts to chime in especially since hnasr mentioned that he figured this out as well.
HighlightRecord.accdb
0
 
LVL 31

Assisted Solution

by:hnasr
hnasr earned 1000 total points
ID: 38773200
Try this:
Form20_2
Record source: Table a(aID, f1, f2, cr_flag)
Controls: Bound: aID, f1, f2, cr_flag, Unbound: txtCurrentKey
cr_flag is used to store the currentRecord value when moving to a new record. It sets the value back to 0 before updating.
txtCurrentKey stores the current key of processed record

Private Sub Form_BeforeUpdate(Cancel As Integer)
    cr_flag = 0
End Sub
Private Sub Form_Current()
    txtCurrentKey = CInt(Nz(aID, 0))
    If NewRecord Then
        cr_flag = CurrentRecord
    End If
End Sub

Conditional formatting:
Expression Is ([txtCurrentKey]=Nz([aID],0)) And ([txtCurrentKey]<>[cr_flag])
Q-27993988-Highlight-current.accdb
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 38773292
@hnsar
Nice going!
0
 

Author Comment

by:peispud
ID: 38774000
This is PERFECT.!!!

Those few lines of code make all the difference.  The user experience is clear and consistant.

Thank you both.!
0
 

Author Closing Comment

by:peispud
ID: 38774004
This is PERFECT.!!!

Those few lines of code make all the difference.  The user experience is clear and consistant.

Thank you both.!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question