?
Solved

highlight an entire row in Access when record is being adjusted...

Posted on 2005-03-03
16
Medium Priority
?
393 Views
Last Modified: 2008-01-09
I just want to simply have an entire row highlighted on a formDS wherever the cursor is (like when you click the left-most column to select an entire row to delete it).  From the searching that I've done here seems like I would have to come up with something pretty complicated?  Am I wrong?
0
Comment
Question by:stephenlecomptejr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
  • 4
16 Comments
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 1000 total points
ID: 13455077
If it's on a datasheet, it's not really possible. On a continuous form, it may be possible to simulate it, but it won't really have the same effect. You can change the background of the current control fairly easily though.
0
 
LVL 54

Assisted Solution

by:nico5038
nico5038 earned 1000 total points
ID: 13455079
Only like making it "selected" like:
http://www.experts-exchange.com/Databases/MS_Access/Q_20598074.html

Nic;o)
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 13455086
Trouble with selecting the record of course, is that it gets "unselected" when you start editing a field :(
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 54

Expert Comment

by:nico5038
ID: 13455153
That's why I posted "Only" Shane :-)

But perhaps this code could be used:
http://www.comriesoftware.net/codewidgets/product.aspx?key=146

Nic;o)
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 13455173
I was thinking about something similar to that, but I can't for the life of me figure out how to get it to change the bg colour of just the current row.

Actually, I suppose you could use something like the serialise function to number the rows and check if the CurrentRecord property is the same as the row number but that would be veeeerrryyyyy slow and wouldn't work if the user sorted the form.
0
 
LVL 1

Author Comment

by:stephenlecomptejr
ID: 13455385
Private Sub Form_Current()
    DoCmd.RunCommand acCmdSelectRecord
    Me.Refresh
End Sub


I like using the above code.
If there was a way for the form to go to the specific record (row, column) you click on after its highlighted without having to double-click on it would be great!
0
 
LVL 54

Expert Comment

by:nico5038
ID: 13455404
I got the code from the link working with a form and a unique (text) key like:

Option Compare Database
Option Explicit

Private Sub Form_Current()
CurrentDb.Execute ("update tblTest set rs = false where keyfield ='" & pbPrevious & "'")
CurrentDb.Execute ("update tblTest set rs = true where keyfield ='" & Me.KeyField & "'")
pbPrevious = Me.KeyField
End Sub

Private Sub Form_Load()
ResetConditions Me
SetConditions Me
End Sub

And in the modules section:
Option Compare Database
Option Explicit

Public pbPrevious As String
Public pbCurrent As String

Public Sub SetConditions(frm As Form)
''\\THE NEXT LINE WILL IGNORE CONTROLS SUCH AS LABELS AND COMMAND BUTTONS
On Error Resume Next
Dim BColor As Long
Dim ctl As Control
''\\CHANGE THE BACKGROUND COLOR ON THE NEXT LINE
BColor = 14803425
For Each ctl In frm.Controls
With ctl.FormatConditions.Add(acExpression, acNotEqual, "[RS]")
.BackColor = BColor
End With
Next

End Sub

Public Sub ResetConditions(frm As Form)
On Error Resume Next
Dim BColor As Long
Dim ctl As Control
BColor = -2147483633
For Each ctl In frm.Controls
''\\ REMOVE PREVIOUS FORMATS
ctl.FormatConditions.Item(0).Delete
ctl.FormatConditions.Item(1).Delete
ctl.FormatConditions.Item(2).Delete
Next

End Sub

But on my test dataset with 3000 rows the refresh interval (Tools/Options/Advanced) had to be set to 1 sec to get it a bit "responsive" and the table will need to be expanded with the field RS of the Yes/No datatype.

Nic;o)
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 13455443
0
 
LVL 54

Expert Comment

by:nico5038
ID: 13456736
Looks nice, but is a continuous form with transparent fields solution and no datasheet....

Nic;o)
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 13457013
Yes, I couldn't figure out how to set the format conditions for a datasheet (although it was very late and I was quite tired).
0
 
LVL 54

Expert Comment

by:nico5038
ID: 13480951
Hmm, odd I thought my code was exactly solving your question...

Nic;o)
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 13480965
stephenlecomptejr, any feedback?
0
 
LVL 1

Author Comment

by:stephenlecomptejr
ID: 13495824
Nico,... I get an error under Public Sub SetConditions.

highlighting specifically acExpression at the following:

With ctl.FormatConditions.Add(acExpression, acNotEqual, "[RS]")

But of course, I do have Access 97.
0
 
LVL 1

Author Comment

by:stephenlecomptejr
ID: 13495827
How can I add feedback?
0
 
LVL 1

Author Comment

by:stephenlecomptejr
ID: 13495832
In fact, when I type With ctl.  (Format Conditions is not one of my options)
But I betcha probably works in Access 2000 tho.
0
 
LVL 54

Expert Comment

by:nico5038
ID: 13498464
Sorry, won't work under A97 as you need the FormatConditions that have been added in A2000 :-(
Only the "select row" trick will work under all versions.

Nic;o)
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

800 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