Using A Constant

Sep 27, 2006

Hi

Newbie question, here.

I have a table T_RollDate
It only has one field, called RollDate
It only has (and only ever has) one record (being a date)

I also have a form F_RollDate that has T_RollDate as record source, containing a text box that has RollDate as the control source.

It has been suggested to me that I can interrogate the value of the record in T_RollDate as if it were a constant, and use that constant in (eg) other select queries. To be precise, I was told that
forms!F_RollDate!RollDate
would return the value of that record.

I cannot get this to work (assuming that it should be possible). If I refer to forms!F_RollDate!RollDate in an query then when I run the query I am prompted to enter a parameter value for forms!F_RollDate!RollDate, where I had hoped that it would select the value of the only record in T_Rolldate.RollDate.

Any pointers would be much appreciated.

View Replies


ADVERTISEMENT

VBA Constant In Sql Is It Only Evaluated Once?

Aug 13, 2007

Hi at the moment I am using a bit of VBA code like below:

Public Const currentYear As String = "0708"

Static Function GetCurrentYear()
GetCurrentYear = currentYear
End Function

I then call this from my ms access sql statement with GetCurrentYear() am I correct in thinking this will only need to be evaluated once (I am just thinking in terms of performance) as it is a static function and a constant or is there a quicker way to do this. I couldn't see a way to easily get the value from a constant without a function. I may be missing something though thanks for any advice.

View 4 Replies View Related

Display Variable/Constant Value On Text Box

Sep 15, 2005

Hi all,

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?

View 1 Replies View Related

Modules & VBA :: Loop Over Than Declaring Constant

Jun 30, 2015

why my access always go over the loop that I am declaring..Here is a sample of my code:

Code:

Dim rs As New ADODB.Recordset
rs.ActiveConnection = conn
rs.Open mySQL, conn, adOpenDynamic, adLockOptimistic
For lngProd = 1 To 5

[code]...

I get the error of access cannot find the tbl_data6. Where in the declaration I wrote 6??

View 1 Replies View Related

Make A File On Harddrive The Constant Datasource

Jul 29, 2006

Can anyone help me with setting up a Visual Basic project to where the datasource I use is a Access database on my harddrive. This Access database isn't linked to a server or anything. It's just a database I created and would like for my project to open this file everytime it's attempting to pull data. How can I make this connection? If I am able to use ADO, how do I go about doing this? I would think ADO wouldn't be necessary though.

View 1 Replies View Related

Modules & VBA :: Constant Loop With Retry Button

May 29, 2014

I'm trying to do the following with the code below:

1. If the file is not in your My Documents folder than goto errhandler and a message box pops up asking you to retry or cancel.
2. When the user clicks retry it goes back and trys again but if the file still isn't there a runtime error 1004 occurs.

I want it to continue to loop when the user presses retry or until cancel is pressed. I've been trying with the code below but no luck.

Code:

Public Function AddITARPicOffloadAnalysis()
Dim xlApp As Object
Dim wb As Object
Dim ws As Object
Dim Lastrow As Long
Dim objFolders As Object
Set xlApp = CreateObject("Excel.Application")

[Code] ....

View 7 Replies View Related

Forms :: Daily Data Collection With Constant Elements

Jan 26, 2014

I have a table that is populated everyday, with following columns:

1. ward (linked to the wards table)
2. date
3. number of patients

We have a total of 18 wards, wherein the daily number of patient in each ward should be recorded. The problem we face is that we find it counter-productive if the data encoder selects a specific ward (dropdown list), then puts the number of patients, and then moves to another field repeating the process. (the date is pre-selected using a combo-box and this will fill the date fields, thus the encoder selects the date only once).

I was wondering if there is a way where we can just automatically show all the wards, so that the data encoder would just proceed on putting the figures.

View 2 Replies View Related

Calculation In A Report - Subtract Calculated Number From A Constant

Aug 25, 2011

I have a column with a sum total in the footer. I would like to subtract this calculated number from a constant (i.e., 20,000.00). Is this possible?

View 3 Replies View Related

Something Like A "Current Control" Constant?

Aug 27, 2007

Hi, I am using a macro in order to change a value after a control has been updated (using the AfterUpdate field). The problem is that I would like to use a single macro for all the controls (since the macro does the same thing on every control and I have many controls), not a new macro every time (nor a macro with many rows); is there any way to put into an expression something like "Current Control" constant instead of [Forms]![New]![Surname], [Forms]![New]![Name] etc...? something like [Forms]![New]![CurrentControl]? Thanks.

View 7 Replies View Related

Date Problem - Part Constant - Part Now()

Nov 3, 2006

Hi everyone,

I have refined my query from previous threads to involved a module function. This calculates more acurately no of working days between dates and takes into account a holidays table. (All credit to Arvin Meyer on the module:) )
However because the Leave Year starts at the 1 July and finishes 30 Jun I need to compose the date for any current year Year(Now())

Enclosed scrdmp shows my query design. I can easily get it to work as you see it, but obviously as each year rolls over, the year needs to change.

Have looked at many posts but can't find what I'm looking for. This one will get me over the hurdle.

Many thanks,

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved