Topics Search

Access 2003: List of "TAG" property of all label controls

Access 2003: List of "TAG" property of all label controls
Views: 9
I have a DB created with Access 2003 on XP Pro SP3.
I would like to check the "TAG" property on all Label controls.
I can do it without problems if the forms are opened, but I haven't found yet a solution when the forms are closed.
I have found the below example on Access Help where it uses AllForms expression.
Unfortunately it returns only the form's name and it seems that there is no way to use the object AccessObject to manage the controls inside the form.

Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
' Search for open AccessObject objects in AllForms collection.
For Each obj In dbs.AllForms
If obj.IsLoaded = True Then
' Print name of obj.
Debug.Print obj.Name
End If
Sponsored Links:

More topics

 

For each... and the forms collection

Preview
Afternoon everyone! Wondered if you could help me out on this rather simple one.

What I need to do is add a string to the tag property of certain textboxes in certain forms in my DB. How do I say "for each form in currentdb.forms"? Here's what I've got so far:

Sub ReTag_Controls() Dim Frm As Form Dim ctl As Control For Each Frm In CurrentProject.AllForms
If InStr(Frm.Name, "Subform") Then
For Each ctl In Frm.Controls
If Not InStr(ctl.Name, "GPD") And Not InStr(ctl.Name, "_") And Not InStr(ctl.Name, "Tagged") And ctl.Type = acTextBox Then
ctl.Tag = ctl.Tag & "No_Export"
End If
Next ctl
End If Next Frm End Sub

I'm getting a type mismatch on the currentproject.allforms line. Grr.
 

Access 2003: How to have a Sequence Number Label Report print

Preview
Using Access 2003:
I have a form with:
Label starts at: ncount
Label sequence: nSequence
Number of Labels to print: nPagePrint
& other fields

When form Button form_Print_Button is selected
- the table (ncount,nSequence) is updated
- DoCmd.OpenReport "rptBarcodeFinishProductLabel", acViewPreview
- DoCmd.PrintOut acPages, 1, 1, , Me.nPagePrint

Everything Works Ok.
The only problem is I want each label to print
sequential number starting at: ncount
Label 1: . Box Number: 1 (assuming ncount=1 and nsequence=1)
Label 2: . Box Number: 2
Label 3: . Box Number: 3
Label 4: . Box Number
 

Modifying Label Caption in VBA Code from Form?

Preview
I have a form that opens a report, and before I open that report I'm trying to change the caption of a label on the report. I'm having troubles accomplishing this. The label is named lblFilter, I've tried.

Report_MyReport.Controls("lblFilter").Caption = txtDate.value
-----
Report_MyReport.lblFilter.Caption = txtDate.value

And, it just not working. I'm not sure how to reference that label's caption property properly.
 

A2007 Some Combo Boxes changing back color on their own as they loose focus?

Preview
Access 2007 as really done it this time. On one form I have five Combo Box controls. I have been working most of the afternoon on UI formatting. Now 2 to 3 of the 5 controls SOMETIMES change their background color from white (asit should be) to the grey that is the form's background color.

Of the controls that do this, at least one SOMETIMES decides to stay white for some list values and only do the grey change color for some values.

Other controls consistently shift to grey when they loose focus.

Thus far, I was only able to find one page mentioning this on the Internet: "2007 Access Combo Box changes Background color after tab through f" [LINK]

I do not see the Alternate Color property on my A2007 Combo Box controls. I do see the property for the "Detail" portion of the Form the Control is placed on. I have already tried my Decompile / Compact / Compile process, and that did not correct the misbehavior.
 

Invisible Controls In Form View/DE "No" Prop Issue

Preview
Yet again, buggy, frustrating, confounding Microsoft has managed to make a horrifyingly simple task inspire me to throw my PC out the window and shortly follow it. Consider this new gem:

I'm not getting existing table records showing up in Form View.

a) There's records in the table.
b) The form's Record Source currently contains one-to-one textbox controls from one table. The only control not sourced to that table is not currently sourced to ANYTHING.
c) The Form "Data Entry" property is set to "No"; the "Recordset Type" is "Dynaset (Inconsistent Updates)".for flexibility; the "Allow Additions" property is set to "Yes".
d) The Form Detail "Visible" property is set to "Yes".

Given those, why in the world would I not be seeing the 14 records in the source table, especially with the "Data Entry" property set to "No"?!
 

Beyond my skillset.

Preview
I am using some code I found on the forum to track changes to my DB.

It works awesome however I was wondering if there is a way I can just write what changed in the mirror table versus the entire record.

Here is the Before Update Code:

Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error Resume Next

' some controls may not have the Tag property ,
' hence the resume next

Dim blnCheckDiff As Boolean
Dim ctl As Control

blnCheckDiff = False
For Each ctl In Me.Controls
If ctl.Tag = "Check" And ctl.Value <> ctl.OldValue Then
blnCheckDiff = True
End If
Next
If blnCheckDiff Then
[Date_Edited] = Now()

Else
Cancel = True
End If
End Sub

And here is the After Update Code:

Private Sub Form_AfterUpdate()
Set db = CurrentDb
db.Execute "INSERT INTO [tbl_MINERAL_MineralOwner EDITS] " _
& " SELECT * FROM [tbl_MINERAL_MineralOwner] WHERE " _
& " [tbl_MINERAL_MineralOwner].[MineralOwner_ID]=" & Me![MineralOwner_ID]
Set db = Nothing
 

Visibility of other controls

Preview
Sometimes you want to control the visibility (or other property) of one control to be based on the value in another.

I have "Option 42" which is a Y/N selection.
I also have "Label 48" which I want to become active only if Option 42 is Yes.

What is the best thing to do in this situation
 

Dynamic Report Label Captions

Preview
I have been using this line of code to dynamically update label captions for my database.

Forms(strFormID).Controls(strLabelID).Properties(" Caption").Value = strlabelcaption

And I was curious if the same could be done for reports as well. I figured one way to est would to use the code below, but it didn't seem to work. Any pointers would be appriciated, thanks.

Reports(strReportName).Controls(strReportLabelID). Properties("Caption").Value = strlabelcaption
 

Question about Northwind Splitform Controls

Preview
all,

I am looking at the NW example, and all of the buttons on the split forms look like this:

Can anyone tell what property is connecting the actual button to the detail section of the split form like that? That sort of thing happens automatically when you create a new columnar autoform in pre-07 versions, but I'm unsure of how to make one of those "connecting" type controls myself. each of them do have something in the TAG field, but it doesn't make much sense.

does anyone know what prop causes that? or how to make one
 

New Version of Invisible Controls In Form View/DE "No" Prop Issue

Preview
Yet again, buggy, frustrating, confounding Microsoft has managed to make a horrifyingly simple task inspire me to throw my PC out the window and shortly follow it. Consider this new gem:

I'm not getting existing table records showing up in Form View.

a) There's records in the table.
b) The form's Record Source currently contains one-to-one textbox controls from one table. The only control not sourced to that table is not currently sourced to ANYTHING.
c) The Form "Data Entry" property is set to "No"; the "Recordset Type" is "Dynaset (Inconsistent Updates)".for flexibility; the "Allow Additions" property is set to "Yes".
d) The Form Detail "Visible" property is set to "Yes".

Given those, why in the world would I not be seeing the 14 records in the source table, especially with the "Data Entry" property set to "No"?!

Confounding Mr. Gates. Confounding.

Mucho thanks ahead of time for advice on this normally/supposedly easy, yet persistent fix.
Windows XP, Access 2007, .accdb file