I am working on a database where I want some specific information displayed on a form, preferably on the form header. I want to display this on all of my forms. In a standard module, I have a code segment that runs a query returning values, and I assign those values to my public variables. I run this code segment triggered by "on activate" of each form.
The variables contain an Event Date, and an Event Name. I want this information to appear on each form. How do I get this data onto my form as part of the form header, or if cannot put on header section, then in the detail section?
Code: Select distinct [tbl_DTP/CTP].id_zlecenia, [tbl_DTP/CTP].Folia_na_lakier_UV, [tbl_DTP/CTP].Wykrojnik, [tbl_DTP/CTP].Makieta, [tbl_DTP/CTP].Matryca_do_tloczenia, [tbl_DTP/CTP].Matryca_do_zlocenia, [tbl_DTP/CTP].kalka, tblGoraZleceniaRoboczeLaczenie.NumerZlecenia from [tbl_DTP/CTP] inner join tblGoraZleceniaRoboczeLaczenie on [tbl_DTP/CTP].id_zlecenia = tblGoraZleceniaRoboczeLaczenie.NumerZlecenia where tblGoraZleceniaRoboczeLaczenie.NumerZlecenia = r1;
Where "r1" is a public variable as string.The variable has value e.g. "10/145" But query can't get this value and all the time ask about value from "r1" :/
Is it possible to open another database, set a Public boolean variable in a module?
in db1: Open database by Access.Application, OpenCurrentDatabase, setting obj to db2.CurrentProject, loop through main objects
in db2: Public ByPassCloseVar As Boolean is in a module ModLinkTblReview
I have a process that opens up a database runs through all of its objects to get their properties and values. There is a form that is set up on Unload to close the tool if the variable is set to False. When I open the form to get the properties and their values, then close the form, it closes the database. I would like to set the variable to true in order for the database to stay open.
Thought something like this would work: db2.Modules!ModLinkTblReview.ByPassCloseVar = True
Indicates that method or data member does not exist.
I have a module that has a global variable defined as shown below
Module: initGlobals -----------------------
Code: Option Compare Database Option Explicit Public strGlobalUserId As String Sub initvar() strGlobalUserId = "Myuserid" End Sub
This is invoked in a login form("frmLogin") and it displays the above value before I replace it with the one that is accepted in the form.
Here is the code from the login form
Code: strGlobalUserId = Me.cboEmployee.Value
When the password is successful, I close the login form and open a form called "frmMainForm". In the form_open event of the "frmMainForm", I am trying to display the user id using strGlobalUserId but it just has spaces. What am I doing wrong?
I have a backup subroutine which automatically triggers when the front-end is closed down (it just takes the back-end, makes a copy and compacts it).It's driven off a hidden form which I use to track who is connected to the BE at any given time. This form is opened as part of the AutoExec when the FE is opened and writes some basic user info to a table. When the form is closed, it updates the table and fires the backup process before quitting Access.
Part of that user tracking process checks to see if the same user is already connected - either elsewhere (i.e. on a different machine) or on the same machine (i.e. opening a second instance of the same FE) - which is undesirable (and, frankly, unlikely, but not impossible) A brief prompt appears to explain that they can only be connected once, at which point the application is quit (to enforce the rule) This also works fine.
I would add a public boolean variable, set it to True by default, then switch it to False if the same user is already logged on before quitting Access.Trouble is, the variable doesn't seem to be holding its value? Here is the Load event for the tracking form :
Code: Private Sub Form_Load()
On Error GoTo ErrorHandler
Dim dbs As Database Dim rst As Recordset Dim strSQL As String Call InterfaceInitialise blnPerformBackup = True
[code]...
For some reason, blnPerformBackup is False every time, even though I set it to True at the very start of the Load event (and it is a Public variable, defined in a separate module where I store all my Public constants and variables)
why it is not retaining its value from the Load event? I've checked and it does get set to True - and when I debug, it remains True - but at runtime it reverts back to False by the time it reaches the decision whether to backup or not?
Question for Documentation purpose: Should the Public Type be declared in its own module?
Or should it be declared in a standard module where non-public functions use it? It is not for a Form module use.
For a Rule Engine, a function is calling one record on 4 different SQL Views (as linked tables) that have the same field format.
For speed, the recordset should only be opened once. However, there are multiple values that must be returned to the result table multiple fields.
One way to return multiple values is an Array. That has over head too.
Another way is to create multiple public variables. Not my choice for documentation. Another is to create a string.
This is a pure code module with several non public functions / subs. What is the documentation preference? List a Public Type close to the function, or place it in the Global module?
Background: A function can only have one return value.
By creating a public Type, multiple values can be returned.
Code: Public Type Income Wages As Currency Dividends As Currency Other As Currency Total As Currency End Type
Use this structure as the return type for a function. In a real situation, the function would look up your database tables to get the values, but the return values would be assigned like this:
Code: Function GetIncome() As Income GetIncome.Wages = 950 GetIncome.Dividends = 570 GetIncome.Other = 52 GetIncome.Total = GetIncome.Wages + GetIncome.Dividends + GetIncome.Other End Function
To use the function, you could type into the Immediate Window:
GetIncome().Wages
(Note: the use of "Public" in the Type declaration gives it sufficient scope.)
Important Notice The way this function is called will work, but is wrong from the aspect it re-calls the recordset over and over.
I've got a private sub that runs when the form loads. I want it to get the id of the record which has opened this new form.
The public sub populates the variable but it's Empty going back into my private sub. I'm sure its a simple school boy error but it has me stumped!
I want it public as I need to keep that id as new records are added in the form.
Private Sub Form_Load() FRStudentFundingRequestID 'fundingrequest = FundinRequestID Me.txtFKFReq = FundingRequest End Sub __________________________________ Public Sub FRStudentFundingRequestID() FundingRequest = [Forms]![frmFundingRequest]![txtpk] End Sub
I am using a public function to feed a variable string to a query. So far I have got:
Code: Public Function ClientStreetModule(firstLVar As Variant, streetVar As Variant, newFL As Variant) As String Dim cslStr1 As String, newStreet As String newStreet = Right(streetVar, Len(streetVar) - Len(newFL))
[code]....
However, I only need to use newStreet as the true part of iif, in which instance all are longer. At least I think this is the problem. I realise I might need to use NZ but am not sure how. Why it is evaluating and giving errors for all records and not just when the iif criteria is true as I want it to?
I wrote a program in Access 2003 and it works perfectly on my computer but when I run it in another one , there is a problem.
The problem is : on a form Ioad I calculate a value and I declared it as public. I need to use this value in my form but it does not recognize it. As if public statement does not work.
Is this from the Windows?
Again, it works on my computer but I have a problem elsewhere.
I tried to display a variable and constant onto a text box by putting =myvariable onto the data source of the text box. However, Access seems keep threating my variable as a data field and giving me error message. What to do with this?
I have been given a form that you pass a parameter into and on the basis of this it performs certain amendments to the particular data AND also runs 2 stored procedures on this data. I need to get the data to display on the form so that the user can visually verify if it is the correct data and then they will on click to execute the amendments and stored procedures.
I cannot get the data to display on the screen? I have tried to create a variable in the VBA code to store the data in and then used a message box to try to display it but to no avail?
I'm trying to write code which writes text into text boxes on a form depending of certain content of other text boxes. The names of the text boxes are all very similar
F.i. R1, R2, R3 ...... R12 if the content of these boxes are empty then the content of the corresponding text boxes VR1, IR1, VR2, IR2, VR3, IR3.......VR12, IR12 should also be empty.
In fact I am trying to write something like this
DO UNTIL i=12 if me.R(i).value = "" then me.VR(i).value = "" me.IR(i).value = "" endif LOOP
But this isn't working. The solution below works but isn't a very nice one, writing 12 times the same code
if me.R1.value = "" then me.VR1.value = "" me.IR1.value = "" endif
if me.R2.value = "" then me.VR2.value = "" me.IR2.value = "" endif
I have created a Public Function that would get a new Production Instructions number based off the [PI Number] of Tbl_Production_Instruction table.
I have a form that people will put in all information but the PI Number, then when ready they will click a button to update the PI Number. I place an unbound txtbox that will be hidden, with the control source to =NewPINum(), but when I tested the see if the unbound txtbox was populated with the new PI Number it was blank.can't figure out what I am doing wrong.
Code: Public Function NewPINum() As String Dim vNum As String Dim strYYMM As String Dim getnextPI As String strYYMM = Format(Date, "yy") & "-" & Format(Date, "mm") & "-" If strYYMM = Left(DMax("[PI Number]", "Tbl_Production_Instruction"), 6) Then vNum = Right(DMax("[PI Number]", "Tbl_Production_Instruction"), 3) vNum = vNum + 1 getnextPI = Format(Date, "yy") & "-" & Format(Date, "mm") & "-" & Format(vNum, "000")Else vNum = "001" getnextPI = Format(Date, "yy") & "-" & Format(Date, "mm") & "-" & Format(vNum, "000") End If End Function
What I would like to do is create a list box that will only display the information from another form that is related to the current form.So I have a form call Equipment Catalog and that form is related to Equipment features 1 to M relationship and the Equipment Features is related to a Features form M to 1.
So what I want to do is display all the related equipment features in a listbox that is related to the current PK of that form.So if there is only one feature on one form the list box will only display that one item however is there is 6 features on another it will display all 6.I have been trying SQL and Queries but I still can't get it to work.
Here's my table/query/form info: Query is called "Methods Count" Field of that query which I want displayed on the sub form is "CountOfMethodID" Sub form is "Quarters and peals sub" Main form is "Form4b" Both form and sub are parent/child linked
There is a Relationship between the VisitID field in the "Visit Dates" table and the MethodsRungVisitID field of the "Methods Rung" table.
I want to display today's date on a form. No connection to a table or anything like that just a label or such. I have a placed a text box on the form and set the Control Source to '=Date()' and it displays the date in a short form, eg. 11/11/2014.
What I want to do is display it in what I think is called Medium Date so that it displays as 11-Nov-2014. I suspect I need to place something inside those parentheses, but what?
I need to put in a form which basically lists all the clients names, with a button next door to each name, allowing them to edit their details. Is this possible.
Basically when loading the form, all client names are displayed in alphabetical order. Clicking on the edit button next door to the client, displays the client details in another form for easy editing. How can I do this .
I have a field called PriceSoldFor and I need to calculate and display this field multiplied by 3.4%. This is what I have tried and reading elsewhere it should work.In the Control Source of an unbound TextBox I have entered the following:
=[PriceSoldFor]*[.034]
But when I view the form the field displays the following:
How can I control the display of fields in a form? I see in a given database, that in the design view that some fields exist in a form but in the form-view some of them are not displayed.
I can't find how it was done, i see no difference in the fields' properties. Another question is how can i make a comboBox to display just the text without the ID number...
Display data from Query into Form..I am attaching the database dbtest.zip which contains a table, couple of queries and form.I have done what ever settings I could after going thru some tutorials / discussion forums online, but to no avail.
All that I want is, when I open the form "frmtest" in "form view", and select CS in Combo 8, the corresponding fields in the form viz Item name, Sl No and System Name should get updated on the form. I want to view it in "Single Form" format.
I have created a database to track our contacts for the office. I spent some time working on the relationships and making sure everything was normalized, as I've only just recently understood that concept. However, I'm afraid something got messed up in the process and I may have missed a step or done something wrong when creating the relationships.
Basically, I just created the form with all of my fields in it and when I try to view the form I see that no fields display (it's just a blank white screen). I wondered if I should actually be creating the form based off tblcontact, and then add subforms for each of the other tables.
See my attached database for further reference ...