Modules & VBA :: Write A Loop To Make Certain Elements In Access Report Visible / Invisible
Aug 23, 2013
I am trying to improve my code by making it more readible. The following code works, but it is certainly not the most efficient way. I`m trying to write a loop to make certain elements in an Access report visible/invisible, but I can`t address the visibility property of these items while iterating over i.
Code:
DoCmd.OpenReport "tblInterval subreport", acViewDesign, , , acHidden
Reports![tblInterval subreport]!BoxInsp1.Visible = False
Reports![tblInterval subreport]!BoxInsp2.Visible = False
Reports![tblInterval subreport]!BoxInsp3.Visible = False
[code]...
View Replies
ADVERTISEMENT
Nov 8, 2013
I'm trying to get some labels and eventually text boxes to become visible on an input of a qty in a text box, but I can't get my syntax right.Here's what I have so far.
Private Sub More_qty_AfterUpdate()
Dim count As Integer
Dim pumplbl As String
For count = 1 To [More qty].Value
pumplbl = "pumplbl" & count
pumplbl.Visible = True
Next count
End Sub
View 3 Replies
View Related
May 10, 2014
I'm working on a report. I have a text box that contains directory path for a picture which is showed in a image box on my report which works great. I have now created a label called "nopiclb" that has "no Pic "entered in it but I want to set the label to not visible if path1 has a file path in it but visible if path1 is empty
I put the code below in onformat event in the detail section, but is not working
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(Me.path1) = True Or Me.path1 = "" Then
Me.Nopiclb.Visible = True
Else
Me.Nopiclb.Visible = False
End If
End Sub
View 3 Replies
View Related
Apr 17, 2015
I've accomplished some simpler things like hiding fields based on the data in another field but nothing very complex. To the point: I have a report that shows data in both rows and columns, the report has a 7 columns, 3 of which could or could not contain data other than zero, in which case the column is not displayed. The problem I have is that it could be any of those three at any given time depending on what data is available for that report and what the user wants to see. Basically, if a given company has no data regarding column "A", then column A is hidden, but the main grouping is done through rows so all companies contain at least 0 for all columns (what I did is that, if a field sums the whole column returns 0, then the column is not visible). What I need to get working is the second part of this, have the columns rearrange themselves depending on which column is hidden (it could be that all 3 are hidden). How could I make this work? (btw, autoshrink is not usefull for this since it only shrinks vertically, not horizontally).
View 9 Replies
View Related
Apr 27, 2014
From Excel, I open a database and start a macro with the following:
Set oApp = CreateObject("Access.Application")
oApp.Visible = False
oApp.OpenCurrentDatabase db, True
oApp.DoCmd.RunMacro "Import_Data"
With the macro running and Access not visible, how can I make the database visible if an error occurs in the macro? Currently, if an error occurs in the macro, a 'Msgbox' message is generated (by the database macro). But with Access not visible and Excel visible, the process cannot continue unless the user knows to click on the 'Microsoft Access' icon in the task bar to bring Access to foreground and acknowledge the 'Msgbox' message.
I'd like to activate the Access window from within the database macro.
View 3 Replies
View Related
Mar 24, 2015
I have a Main Form with a Sub-Form, the sub-form is base off a query. on the sub-form i have 8 controls, one of them is "Status' and "Process" and "Review" My Main Form have a Refresh command that refreshes the data in the sub-form.
What i am trying to do is make the "Process" Control only visible is "Status" is a certain status and "Review" visible if "Status" is something else. what i have done works correctly On Open. I run into and issue on the refresh command. I get Run-time error '2165' "You can't hide a control that has the focus"
Code:
If Forms!Main_Form.[Name subform]!Status = "Ready" Then
Forms!Main_Form.[Name subform]!Process.Visible = True
Forms!Main_Form.[Name subform]!Review.Visible = False
ElseIf Forms!Main_Form.[Name subform]!Status = "Reviewing" Then
Forms!Main_Form.[Name subform]!Review.Visible = True
Forms!Main_Form.[Name subform]!Process.Visible = False
End If
I have done similar with a main form and making sub-form visible or not based on a control on a main form and that has worked perfectly. I am not sure how the control is getting focus and cause the error.
View 4 Replies
View Related
Dec 2, 2014
My company has a new database that we will use to track PTO (paid time off/vacation), including the submission/approval process. Not everyone should have access to the approval dashboard as that should be restricted to only managers. Everyone will have the same basic form so that they can see their PTO history, hours remaining to be used, etc.
What I want to do is have a button on the form that is visible only if the person is a manager. The button will open the PTO approval form. How can I make a button visible/invisible based on user access levels?
View 11 Replies
View Related
Sep 22, 2013
How do I make a control invisible?
View 5 Replies
View Related
Aug 13, 2005
I want my fields on the report to show up if there is data to show and to disappear if no data is avaliable. Also, will the fields format together or will they still stay apart? I need them closer together for the report.
Here we go.
In the report are months 1, 2 and 3 as well as the label box for each. I need the label box and the data(text box) to disappear when the data box is null. This is where I had started:
Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)
If Not IsNull(Me.Ctl1_Month) Then Me.Ctl1_Month.Visible = True
Else
Me.Ctl1_Month.Visible = False
End If
End Sub
But when I try and run the report I get this error:
Can't Execute Code in Design Mode.
Can someone help as to what I have done wrong or where I should place this type of format?
Many thanks.
View 8 Replies
View Related
Aug 28, 2014
I have a form with a Yes/No checkbox. Sometimes a data entry person will use this, sometimes an associated report is printed and a technician in the field will be required to fill check the box by hand and return the report for data entry. what I have tried to format the check box, if the box isn't already checked, I can't get it to show up clearly on the printed report. It's set to Visible, width 6pt, solid, black, always display, yet it still is barely visible. Ive tried increasing the grid line thicknesses, making it shadowed, nothing seems to work. Is there anything I can do?
View 9 Replies
View Related
Dec 16, 2013
I am building a report that has a header with several details followed by a detail section.
What I need to do is make the entire entry not visible on the report if one of the dates is null.
So it looks like this
last first title id memb # date a date b
1. smith , john fng 8521 2356224
5/12/2012 6/20/2013
10/2/2013 (is null)
2. neckbone, jim dude 2548 85858412
6/20/2013 5/5/2014
8/5/2013 2/31/2013
On the report i want the 1st entry (smith john) not to be visible due to the null (B) Date.... but i want it to be visible once the date is entered...
View 2 Replies
View Related
Feb 26, 2005
I have tried searching a few threads, but can't get the answer or perhaps i'm tired. Anyway I have a YES/NO field and a command button. I want the button to be visible only if the yes field has been selected. No = invisible button.
Thanx
View 2 Replies
View Related
Mar 9, 2006
I was able to use coding for making controls visible or not in the attached database.
I have a main form with a tab control that has 3 tabs with subforms in them.
What I am not able to do is in the Tab Control I want the 3rd tab to be invisible and on the second tab where it says “May we go through the questions now?”, I have a check box. When that check box is checked I want the 3rd tab to become visible.
I am having problems figuring out this code to reference the Tab Control Page.
Do you have any suggestions?
I can attached the database if necessary.
I appreciate any help that you can give me.
View 5 Replies
View Related
May 11, 2006
I am trying to make a subform appear when a particular entry is selected from a list box. I did a test... no problem. In my real database... well, you know. Here's my code:
----
On my main form property:
Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
DoCmd.GoToRecord , , acNewRec
If Me![ProjectSubType] = "Commercial Chest" Then
Me![CommercialChestsSubForm].Visible = True
Else
Me![CommercialChestsSubForm].Visible = False
End If
End Sub
----
On my list box property:
Private Sub ProjectSubType_AfterUpdate()
If Me![ProjectSubType] = "Commercial Chest" Then
Me![CommercialChestsSubForm].Visible = True
Else
Me![CommercialChestsSubForm].Visible = False
End If
End Sub
----
Any help is GREATLY APPRECIATED.
Tom
View 2 Replies
View Related
Jan 19, 2006
on a report that has 2 pages, how can I make a text box in the bottom of the report page 1 invisible, but visible on page 2
you help will be much appreciated
Jabez
View 7 Replies
View Related
May 9, 2014
I am trying to make a label visible on a form during print if a field has "like a string". We use a form so that it prints 3 forms to one page (They are tags for units for repair). I can get the label to be visible in the form view but when I print, the label is visible on every record where it is only visible on the current record in form view. My goal is to have the label only show on those records where the condition is met.
Here is my code that works in form view only: (It is to designate easier a warranty tag from a new repair tag)
Code:
If Me.Problem_Description Like "Warr*" Then
Me.lbl_w.Visible = True
Else
Me.lbl_w.Visible = False
End If
I have attached an image of a tag sheet Tag_Sheet_W.jpg. As you can see if I got my desired result only the first tag would have a W.
View 1 Replies
View Related
Feb 16, 2007
My question is how can I make data in a form visible or invisible just by a button. In other words, if I have a group of buttons, based on the button selected I would want certain data to appear.
I know that this is possible, I have seen it done but just cannot find out how to do it or what this is called to look it up in Helps.
Thanks,
****
View 5 Replies
View Related
Jul 16, 2014
Form name: TestForm
Combobox name: cboName
Names in combobox: Rick, John, Sarah
Feilds: Feild1 Feild2 Feild3
EDIT: The names in the combobox are coming from their own table, they were not manually put into the combobox.
Here is some pseudocode for what I kind of want to do...
[open TestForm]
if cboName = Rick
Field1.Visible = true
Field2.Visible = false
Field3.Visible = false
if cboName = John
Field1.Visible = false
Field2.Visible = true
Field3.Visible = false
if cboName = Sarah
Field1.Visible = false
Field2.Visible = false
Field3.Visible = true
View 14 Replies
View Related
Jun 18, 2015
I need to have a subform that shows up smack dab in the middle of my main screen when visible - which is what I want - but only based on a specific value of a control on the main form. Specifically, if a control's value is "See Spreadsheet", I want the subform visible front and center as it contains the link to the server location for that specific record. If the control's value is not "See Spreadsheet", I want the form to be invisible.
My code:
If Me.BudgetsFacultyAccountNumber = "SEE SPREADSHEET" Then
Me.frmMsgBoxUpdateSpreadsheet.Form.Visible = True
Me.BudgetsFacultyServerLocation.Visible = True
Else:
Me.frmMsgBoxUpdateSpreadsheet.Form.Visible = False
Me.BudgetsFacultyServerLocation.Visible = False
End If
The red lines result in an MS VBA error: "Compile error: Method or data member not found."
I've tried referencing that subform a hundred different ways, but I can't get it to work.
View 5 Replies
View Related
Apr 14, 2015
I run a merge process from VBA code to create word documents. I would like to add 2 word tables to a document and only show them based on some parameter or mergefield in the data.
Can a table be identified? Like Table 1. And can it be made invisible?
View 5 Replies
View Related
May 3, 2006
Hi there,
I know there have been a good number of questions about visibility in forms already but I couldn't find a solution to my problem (or maybe I just didn't get it).
Basically, I have a tabular form (more than one record displayed at once) and one the field is of the Yes/No type. For each record, I'd like to have a text box that displays 'pending', set as visible if the field value is 'Yes' and set as invisible if the field value is 'No'.
The table is as follows:
id : auto-number
Flag: Yes/No [Yes]
If I use the following code on the Flag button:
Private Sub Flag_AfterUpdate()
Me.pending2.Visible = Me.Flag.Value
End Sub
all the 'pending' text boxes appear and disappear together (instead of just the relevant one).
I thought of using another text box, with the same data source ('Flag') but which would set itself to visible or invisible wrt to its own value but I couldn't find a way to do it.
Any suggestions ?
Thanks in advance !
and many thanks already for the forum and the contributions - it's been extremely helpful, esp. for a beginner.
View 2 Replies
View Related
Oct 23, 2004
I am trying to make a button on a form visible and invisible dependant on the contents of a field in my form, any ideas?
View 3 Replies
View Related
Apr 22, 2005
I belive I have done this before but I cant remember how!
I have a continuos form with two text boxes on it and a check box.
I am trying to say if text box1 = "1" then text box 2 is visible if text box 1 = 2 then text box 2 is invisible. I am doing this on a tick box (for other reasons) so my code looks like this:
If Me.Text1 = "1" Then
Me.Text2.Visible = True
End If
If Me.Text1 = "2" Then
Me.Text2.Visible = False
End If
It works, kind of. The trouble is because its a continuous form all the Text2 boxes become visible or invisible depending rather than just the one record i'm working on. Is there a soloution to this?
View 1 Replies
View Related
Jul 1, 2015
I need to display the year, Date, agent name, amount field, note and sub total for each year.I need to write the SQL query code in VBA and i designed the report with proper field positions.
YEAR column: Display Value only once for the FIRST ROW for Maximum value of Date field value for each set of YEAR. If it has only one record, it display that year.SUB TOTAL Column: Display Total Value for Amount field only once for the LAST ROW of each set of year record (Mininum value of year). How to make it available the values for first and last record alone ?
I just wrote my SQL code based on your inputs in my editor..Based on the input from Plog (from this forum), i wrote a code which listed below.
Code:
Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = "SELECT CessioneCredito.Anno, CessioneCredito.Data_Movimento, CessioneCredito.Note_Liq_Cessione_Credito, CessioneCredito.Importo, " & _
" Agenzie.Denominazione, DCount("[Anno]","CessioneCredito","[Anno]=" & [Anno]) AS GroupSize,
[Code] ....
While saving it, it shows the code in RED COLOR due to compilation error.As I am writing the query in Me.Recordsource = "SQL query", where i should place the below listed code in the query as per Plog???
Change the Year Control Source to this:
=IIf([GroupPos]=1,[Year])
Change the GroupTotal Control Source to this:
=IIf([GroupPos]=[GroupSize],[GroupTotal])
If this is not possible in Me.recordsource, then its advisable to use recordset like writing in two different queries.
Code:
Dim ds1 As Recordset
Dim ds2 As Recordset
myquery1 = "SELECT CessioneCredito.ID_Agente, CessioneCredito.Data_Movimento, CessioneCredito.Importo, CessioneCredito.Anno, CessioneCredito.Note_Liq_Cessione_Credito, Agenzie.Denominazione
FROM CessioneCredito INNER JOIN Agenzie ON CessioneCredito.ID_Agente=Agenzie.ID_agenzia
WHERE (((CessioneCredito.ID_Agente)=[Reports]![R_StoricoCessCredAg]![ID_Agente]))"
[code]....
View 2 Replies
View Related
Aug 2, 2006
Is it possible to make my Splash screen invisible after someone checked the "Do not show me this screen again" just while that current session? Is there a way of using flags and a system table or query that would allow me to do so? Thank you:)
View 2 Replies
View Related
Jul 4, 2005
I have a form display project hours and also caculation of total for each project.
A user can spend time on multiple projects each day, I would like all zero invisiable. I had tried to set all default values to null (nothing) instead of zero. It causes problem in caculation of total.
I remember in Excel, it can make zero not to display, can we do this on an Access Form?
(Something I also want to know if this is possible. This is a time sheet, is anyway we can do on the form that projects (records) can be displayed horizonatally (on the top) while the dates can be displayed vertically (on the left), ,more like a transposed. But it would not change the struture of database (just display) so the date remains a field and projects are records.)
Thank you for help. Happy July 4th
View 4 Replies
View Related