473,434 Members | 1,507 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,434 software developers and data experts.

Alternate colors in an Unbound Continuous Form

SueHopson
47 32bit
Hi Everyone,

All my research leads to http://www.lebans.com/alternatecolordetailsection.htm BUT it's a .mdb file I can't open so I'm not sure if it will help my learning curve or not. I also looked at this topic frim Michael R. [Row numbers and alternate colors to a Continuous Form] but couldn't decipher it.

Can anyone help me access the content please or guide me in the right direction?

For the subforms the following is true:

Property Sheet.Data
.Row Source = qryQx1_QuoteList
.Link Master Fields = CxID
.Link Child Fields = QxCxID

Basically, the subform mu users want is using an unbound List.Rowsource to pull the data since my users prefer to be able to double-click anywhere on the whole line to open the next form (onDoubleClick).

Expand|Select|Wrap|Line Numbers
  1. Private Sub OpenQxDetails_DblClick(Cancel As Integer)
  2.  
  3.     Dim strOpenQuote As String
  4.     Dim stLinkCriteria As String
  5.     stLinkCriteria = "[QxNbr]=" & Me.[QxNbr]
  6.     strOpenQuote = "frmMainQuote"
  7.     DoCmd.OpenForm strOpenQuote, , , stLinkCriteria, acFormEdit
  8.  
  9. End Sub
I did show them a version where the subform is bound List.Rowsource as a continuous form. Unfortunately, they didn't like that version because it forced them to click an "Open" hyperlink at the end of the record to open the next form (instead of being able to double clikc anywhere on the line). HOwever, they did like the alternate row colors and have asked if it's possible to keep that feature.

Alternatively, is there a way to make the records on the bound form behave the same way they would in an unbound list?
Apr 6 '23 #1

✓ answered by NeoPa

Hi Sue.

I'm guessing this means you fundamentally have what you need now then (If not then let us know).

As for the code that errors on you, this is becaise you are trying to call a Form object directly, rather than the Double-Click Event Procedure associated with that Form. Very different entities.

When you want the same code to run for various different Events, as you seem to be trying to do, it is possible to write one Event Procedure with the (common) code in it (Not to be confused with The Common Cold of course.) and then call that particular Event Procedure from all the other Event Procedures that require the same code to run. However, this is frankly a messy approach. What I always recommend is to separate the common code out into its own separate (standard) procedure and then get each of the Event Procedures to call this code. You can even set the properties of the Events on the object to call this standard procedure directly and avoid even the stub of the Event procedure in your code - but only if it's a Function Procedure --> One that returns a value.

Whichever way you choose to do that it's better to encapsulate that logic in its own procedure and invoke it from the Events. I hope that makes sense.

4 11757
NeoPa
32,556 Expert Mod 16PB
Hi Sue.

I'm not absolutely sure I understand what you're asking for so I thought I'd just mention that Forms in ACCDBs (At least from my version 2019 & onwards but likely all of them) have alternating colours for Detail section backgrounds as standard. The properties to set are Back Color & Alternate Back Color. It's no longer necessary to manage this in complicated code.
Apr 6 '23 #2
SueHopson
47 32bit
Hey Neo :)

That's the version I have been working off, and it works great.

The original problem came from the previous designer's code. By using an unbound list set with column counts, she was able to display the data in a list display that would highlight the whole row whenever you clicked on any individual field. Then if the user double-clicked anywhere it would open the next form.

I think I have found an inelegant solution to being able to double-click anywhere on the bound form and have the form open, mimicking the original "style" if you will.

Expand|Select|Wrap|Line Numbers
  1. Private Sub frmOpenQuote_DblClick(Cancel As Integer)
  2.     Dim strOpenQuote As String
  3.     Dim stLinkCriteria As String
  4.     stLinkCriteria = "[QxNbr]=" & Me.[QxNbr]
  5.     strOpenQuote = "frmMainQuote"
  6.     DoCmd.OpenForm strOpenQuote, , , stLinkCriteria, acFormEdit
  7. End Sub
This works well if I apply the code to each of the fields on the form detail, and since there are only 3 on my first subform it's an easy fix.
So these are all using the same code as above at the moment.
  1. Private Sub QxNbr_DblClick(Cancel As Integer)
  2. Private Sub QxStatus_DblClick(Cancel As Integer)
  3. Private Sub QxDescription_DblClick(Cancel As Integer)
  4. Private Sub Form_DblClick(Cancel As Integer)
Private Sub frmOpenQuote_DblClick(Cancel As Integer)

I had originally tried calling the frmOpenQuote code for the other subs, but I kept getting this error, so that's perplexing me a bit...
Compile error: Sub or Function not defined

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_DblClick(Cancel As Integer)
  2.     Call frmOpenQuote
  3. End Sub
I've also set this code to highlight the record when it's selected:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_HasFocus()
  2.     Detail.BackColor(Me.Color) = vbBlue
  3. End Sub
So not ideal but it look very similar and is functional.
Apr 6 '23 #3
NeoPa
32,556 Expert Mod 16PB
Hi Sue.

I'm guessing this means you fundamentally have what you need now then (If not then let us know).

As for the code that errors on you, this is becaise you are trying to call a Form object directly, rather than the Double-Click Event Procedure associated with that Form. Very different entities.

When you want the same code to run for various different Events, as you seem to be trying to do, it is possible to write one Event Procedure with the (common) code in it (Not to be confused with The Common Cold of course.) and then call that particular Event Procedure from all the other Event Procedures that require the same code to run. However, this is frankly a messy approach. What I always recommend is to separate the common code out into its own separate (standard) procedure and then get each of the Event Procedures to call this code. You can even set the properties of the Events on the object to call this standard procedure directly and avoid even the stub of the Event procedure in your code - but only if it's a Function Procedure --> One that returns a value.

Whichever way you choose to do that it's better to encapsulate that logic in its own procedure and invoke it from the Events. I hope that makes sense.
Apr 9 '23 #4
SueHopson
47 32bit
NeoPa = My Access Hero!
Today I learned about inserting procedures - thank you!
Apr 12 '23 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Prakash Wadhwani | last post by:
Is there any EASY way to highlight a full row in a continuous form so that as i navigate up & down the table/continuous form using the arrow keys, the entire line (all fields) get highlighted ? ...
3
by: Pat | last post by:
Hello, I've used Sum() to total bound fields on a continuous form with no problem. However, I now have a continuous form, on which I use an unbound field to calculate the number of hours between...
3
by: David | last post by:
Hi, I need a button shown for each record (cont. form) with specific captions on each. I have a notes form for each record. When a user presses the button they can read the notes. I want to...
4
by: Kathy | last post by:
What is the standard technique for handling the fields in the following scenario on a continuous form? Multiple Divisions. Each Division has multiple Buildings. Each Building has a Supervisor. ...
10
by: DFS | last post by:
I'm sure this has been discussed before, but I'm too tired to hunt for it. I have a survey table containing questions with different answer scales. Some are 1 to 5, others are A,B,C, etc. I show...
20
by: Robert | last post by:
Need some help to stop me going around in circles on this one.... Have a nested subform (subform2) which simulates a continuous form for the record on the parent subform. Subform2 has rows of...
5
by: Michael R | last post by:
Searching the net I've found a simple technique to add row numbers and alternate colors (for the even and the uneven row) to a continuous form. 1st step: Create a textbox, send it to background...
13
by: eighthman11 | last post by:
using Access 2003 and sql server version 8.0 Hey everyone. Created a text box where the user types in an Inventory number and it takes them to that inventory number on the contimuous form. The...
6
by: Jeroen3131 | last post by:
Hello, I'm developing a database where workinstructions (which consist of Steps) can be created and edited. I'v already completed the "Create" form and it works flawless. Now I'm stuck on the Edit...
1
by: branelly | last post by:
Hello, I am a newbie on access and I need help. I try to avoid asking for help because I usually am lucky enough to find the solution to my problems online, but I'm now stuck. I have continuous...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.