Programming With Control Variables
Jun 12, 2005
The following code is only for testing the usage of control variable. I want to use set statement to assign the textbox object reference to the varialbe myControl.
When I clicked the button, the system always tells me 'the object reference missing'. It seems the set statement doesn't work, but I don;t know the reason. could anyone of you please spot it out for me?
Many thanks
Option Compare Database
Public myControl As control
Public frm As Form
Set frm = Forms!Form1
Sub Command4_Click()
Set myControl = frm!Text0
myControl.SetFocus
End Sub
Sub Command5_Click()
Set myControl = frm!Text2
myControl.SetFocus
End Sub
View Replies
ADVERTISEMENT
Mar 5, 2008
hi all, Newbie to access and am making an asset tracking database for work. I have written a sub that opens a hidden form and queries it. I want to get a value from that hidden form and stick it into a combo box on my origianl form. I have got most things to work. The problem i am having is using a variale in a control form i.e. [forms]![ & strVar & ]![Field] here is the code i have so far
Private Sub Form_Search(strFname As String, strField As String, strFField As String, strWhere_Next As String)
Dim strWhere As String
strWhere = strField & " = " & "" & strFField & ""
strWhereA = "[Forms]![" & strWhere_Next & "]![ALLOCATEDTO]"
DoCmd.OpenForm strFname, acNormal, , strWhere, , acHidden
Me.ALLOCATEDTO.Value = strWhereA
DoCmd.Close acForm, strFname
the strWhereA shows the correct field but is shown as [Forms]![Formname]![ALLOCATEDTO] in my combobox, not the actual value of that form. Please help. I know this is probably a simple syntax error but am now at my wits end!!!
Thanks in advance!
View 6 Replies
View Related
Mar 3, 2006
Hello,
I am new to these forums, and am an idiot in Access. i work for a small nonprofit and manage a project through our state Division of Rehabilitiation Services in providing Assistive Technology Services tp their clients (DORS is an agency which provides services to people with disabilities to gain meaningful employment, increase their independence or be successful in pursuing educational goals).
I have been trying to create a database to track the authorizations/clients I serve, some of them have worked but are a bit too complicated in which i am sure can be put together easier (more efficiently) and basically I am afraid to implement it as it would probably fail. Mainly a merger between a number of templates avaliable for free.
What my question is, is how much does it cost (in general) to hire someone to create the database for me. I am basically looking for a database that will be able to store client information (name, contact etc... information about their disability and their goals (employment, education etc...) who their counselor is and their contact information (multiple clients per counselor).
Now each client may have multiple authorizations (I.E. An Authorization for an Evalutation and then for training). So I need service records related to the specific authorization and then the ability to store invoices and reports related to that authorization as well. I would like it to link to a report as I create them in word and save them on a server. I would also like the ability to have the reports sent to the counselor via e-mail from the database.
Hope this makes sense, if anyone would have a generalized going price for somthing like this in terms of hiring someone to complete it that would be GREAT. Thank you,
Justin
View 6 Replies
View Related
Jan 11, 2008
I have inserted two combo box in the form with lookup in the table. Now I want to select values in these boxes and filter the records having those values on click of a command button placed on the form.
How can it be done without using VBA? Is it possible with use of macro?
Kindly guide.
View 2 Replies
View Related
Mar 29, 2005
Hi,
I am new to programming. I have to design a form in access which contains basic text fields, a combobox and some datefields. I need to use this form to input data to access table and and retrieve data from access table. Can anyone help please.It is very urgent. :confused:
Thanks in advance
vs
View 2 Replies
View Related
Aug 18, 2005
I will appreciate it if somebody will assist me with the required scripts for this page which I will describe below
Page1
To receive data from a form (eg name, email, pin number, results etc)
check wether a particular data (eg pin number) is in a specified table in the database
insert data to the database at the point where the pin number exists, if it exists
of course the language is ADO (ASP/Vbscript)
View 1 Replies
View Related
Jan 20, 2008
Hi folks,
I am new to Access programming. I read in some web page on googling that Access is for developing Desktop database. Books inform that Access projects can connect to Server database.
I would like to know if Access can also be use for Server side programming.
- Krish:confused:
View 2 Replies
View Related
Sep 7, 2005
Hi, I am just about to start the implementaion of my A2 computing project, hopefully using both access and pascal to create a bar ordering and stock control system. My question is how and how easy would it be to link both the pascal side of the system and the access application so that they are sychronised? The access application would be used as a front end to my system, and a store of inforamtion where as the pascal code would be used to carry out the necessary calculations.
any ideas woud be appreciated
many thanks
View 2 Replies
View Related
Nov 1, 2005
I know this topic has been discussed, but i could not find one thread on the general purpose of exporting an excel table/form to excel.
I would like to place a command button on my FORM, and let the user click this button and export the data into excel.
I tried using the transferspreadsheet method, but could not corrrectly, if at all get it working, and the help section within access2003 onlu covered importing into access from excel.
Please, if anyone has any links to sites/tutorials/ threads i misssed actually covering this topic/or thier own help, it would be greatly appreciated.
Thanks
Connor
View 2 Replies
View Related
Mar 31, 2005
Hi,
Ok. So, here's the task
There are multiple employees on a table, each with a period of time for which they worked. I am trying to gather these times together to see how many complete records I have for the time period of 4/1/1999 to 12/31/2004. So, for example,
Employee 1 works from 4/1/1999 to 12/31/2000.
Employee 2 works from 1/1/2000 to 12/31/2004.
(From these two records, there will be 1 complete record of 4/1/99 to 12/31/04 AND 1 remaining record for the year 2000 left over.)
Employee 3 works from 1/1/2000 to 12/31/2004.
(From these three records, 1 complete record + 2 2000 + 1 each for the years 2000-2004.)
Employee 4 works from 1/1/2001 to 12/31/2003.
(= 1 complete + 2 2000 + 2 2001-2003 + 1 2004)
Employee 5 works from 4/1/1999 to 12/31/1999
(= 2 complete + 1 2000 + 1 2001-2003)
And this goes on for all the employees. I need to find out the end amount of how many complete records and remaining dates all the employees have worked. I hope this was at least, somewhat clear. I remember doing something similar to this ages ago in programming class, but since then, my mind has degraded. =P Any help, insights, or advice would be greatly appreciated on how to get this done. =)
G
View 5 Replies
View Related
Oct 11, 2004
I want to retrieve some parameters from file, So for that i want to implement File Open Dialog
in One of the form. File Open Dialong is available in Micrososft Common Dialog controls.
When i choose Microsoft Common dialog control from extra toolbars, it gives me error saying that "You don't have licence for using Common Control ActiveX.
Any help appreciated.
View 1 Replies
View Related
Jul 9, 2014
I have a form which gets information from the user and upon pressing a button I produce address labels for the user. The form calls a report which does the job. This works. Now the user would like to have parameters like fonttype, fontsize and fontcolour together with margins, row and column space so that the output can be better tailored to his needs. I have inserted combo boxes on the form to get these parameters from the user, but how am I going to insert these parameters in the report layout through programming. What should be the approach?
View 5 Replies
View Related
Aug 15, 2006
Hi, here is a query which returns rolling sum for past5days.The resulting table has threee columns,namely,
MyDateFiled ,MyValue,Past5DaySum
SELECT tblData.MyDateField, tblData.MyValue,
(SELECT SUM(a.MyValue)
FROM tblData As a
WHERE DateDiff("d",a.MyDateField,tblData.MyDateField)
Between 0 and 4)
AS Past5DaySum
FROM tblData;
Someone help me in modifying the above query ,so that ,a Type(1,2,3) can be assigned to each Past5DaySum
based on the following criteria.Is,it possible to use IIF function for three variables ?,so as tp get a new table(Mydate,MyValue,PastDaySum,Type)
Type,LeanPeriod,GoodPeriod
1, A<5 , A<20
2, 5<=A<=10, 20<=A<=40
3, A>10, A>40
LeanPeriod=Jun to Nov
GoodPeriod=Dec to May
View 1 Replies
View Related
May 13, 2007
Hi there, is it at all possible to use variables in sql? Please consider the following snippet:
... (WHERE [DateDue] < Date())...
The idea is to return a recordset where the DateDue is prior to the current date. But sometimes I need the opposite, ie a recordset where DateDue is in the future: ... (WHERE [DateDue] > Date())...
Right now I have 2 long queries which are exactly the same, except for the operator < for the first case above and the operator > for the second.
I of course did not want to repeat the queries so I tried:
Dim op As String
op = Me.txtOp 'txtOp is invisible and gets its value (either "<" or ">" ) thru
'a button click
... (WHERE [DateDue] & op & Date())...
I also tried:
... (WHERE [DateDue] & forms!frmInvoices!txtOp & Date())...
But to my "surprise" both failed.
Can it work? what should I correct or do differently here? I might need this kind of trick for other routines too, so I'd like to avoid copying the same query, just for the operator change.
I hope one of you seasoned sqlers can tell me more about it, I appreciate.
Regards,
Jaime
View 10 Replies
View Related
Mar 3, 2006
I want to create a field named ErrorCases that sums the rows meeting the following conditions: The row has a ValidityReason = 2 and for the same row ExpValidity is either null or 3. I want a count of the rows meeting these condtions.
Here is the formula I have constructed that does not work.
ErrorCases: Sum(IIf(([ValidityReason]="2" And [ExpValidity] Is Null) Or ([ValidityReason]="2" And [ExpValidity]="3"),1,0))
Any suggestions?
View 2 Replies
View Related
Jan 14, 2005
I am trying to incorporate the following code into my code:
Code:If Not QueryExists("Q_ABC") Then Set qdf = db.CreateQueryDef("Q_ABC") Else Set qdf = db.QueryDefs("Q_ABC") End If
Difference is that I want to use a variable to provide the query name...
Code:dim queryname as variantqueryname = "Q_ABC" If Not QueryExists(queryname) Then Set qdf = db.CreateQueryDef(queryname) Else Set qdf = db.QueryDefs(queryname) End If
but this does not work... but neither does this...
Code:dim queryname as variantqueryname = "Q_ABC" If Not QueryExists("queryname") Then Set qdf = db.CreateQueryDef("queryname") Else Set qdf = db.QueryDefs("queryname") End If
nor does this...
Code:dim queryname as variantqueryname = "Q_ABC" If Not QueryExists queryname Then Set qdf = db.CreateQueryDef queryname Else Set qdf = db.QueryDefs queryname End If
Can someone please show me how this is to be done?? I feel that it must be something simple...
Thanks a lot (in advance)!
View 5 Replies
View Related
Oct 28, 2007
The following code recognizes the value of 'TheYear' after running the line of code (ie. "#11/13/2007#"). The problem is it doesn't seem to recognize it in the SQL, but rather asks for a value when I reach the SQL code line. How can I get it to substitute automatically? THANKS!
DoCmd.SetWarnings False
TheYear = "#11/13/" & Year(Now()) & "#"
DoCmd.RunSQL "Update [Employees Trained List] SET [Employees Trained List].[This Years Training Date] = Null WHERE (([Employees Trained List].[This Years Training Date])< TheYear );"
DoCmd.SetWarnings True
View 1 Replies
View Related
Mar 9, 2006
I have started holding variables in text boxes on forms - (variables needed at module level for that form).
Is this a correct thing to do.
The benefits I have are not loosing the value should some error occur - and being able to reference it from another form.
Thanks
Paul
View 3 Replies
View Related
Mar 6, 2008
I am currently making a project as part of my Computing course. The project is a running diary, where users can log in and record their running times(Amongst other things). As part of the system i am going to include a calorie calculator, to do so i have to work out the BMI (Body Mass Index). To do this you have to divide the weight by the square of the height. The weight and height are stored in the tables.
I am planning on creating a form for this conversion which will refer to a query. When the users log-in their ID is stored in a Public Variable called "UserID".
What i would like to do is query the database for their height and weight using this variable, but i don't know how to go about doing this.
Does anyone have any suggestions?
Many Thanks
View 6 Replies
View Related
Nov 2, 2005
Hi
Currently i use one variable as indicated below from a continuous sub form field to open another form
Dim linkcriteria As String
Dim frmRoom As String
frmRoom = "frmRoom "
linkcriteria = "[HeadCloseID] = " & Me.HeadCloseID
DoCmd.OpenForm frmRoom , , , linkcriteria
however, after restructuring some tables, i need to open the form with respect to 2 variables instead of the previous one.
hence my question is can, how, and what code would i use to do this
many thanks in advance
View 3 Replies
View Related
Feb 13, 2006
I have an access form called forma. It has a command button. When I click a command button, FormB opens up and FormA closes. The FormB also has a command button. When I click the command button of Form B, it closes and opens FormC. Like this there are total 30 forms. What I need is. I want to count the no. of clicks of the command button in total. Actually each button is a correct option of A multiple choice question. I tried to declare a public Variable called total in the declareation of the first form and tried to use it directly in the succeding forms. It does not capture the values. How can I increase the value of the varialbe declared in the first form even after the form closes and capture till end. Actually I also should be able to send the value in a table. Please Help Me.!
View 2 Replies
View Related
Jul 10, 2007
Just updated to Access 2007 from 2003 and my app does not pull in any environment variables. =environ("variablename")
Anyone else have this problem?
View 5 Replies
View Related
Feb 3, 2008
I know this is probably obvious but how do I pass through form variables to sql server I currently have:
exec QStudent @_param_cmbYear="0708", @_param_SelID="S", @_param_SelForename="d", @_param_SelSurname="S"
this executes correctly SelID being a student ID or partial ID also allowing for surname forename partial search. I thought it would just be:
exec QStudent @_param_cmbYear=[Forms]![Attendance and Lateness Main]![cmbYear], @_param_SelID="S", @_param_SelForename="d", @_param_SelSurname="S"
to switch acad year to a form variable and repeat for the others but it errors on trying to save the pass through. Thanks for the help.
View 1 Replies
View Related
Dec 5, 2005
Anyone know how to reference a global variable as criteria for a query?
I am currently using invisible text boxes on an intermediary form as criteria for my query and it works fine, but this solution seems inellegant and I'm looking for something a little smoother. I just need the correct syntax to reference a variable in the criteria section of a query.
Thanks!
View 1 Replies
View Related
Jan 29, 2006
I have a table Names containing Recnum and Last Name. I have a table Grades including Recnum, Names and Grades. I have a Report which Through a query Reports the grades and averages for each name. I would like to be able to query for an individual name using an entry form. How do I get the name from the form into the Criteria in the query grid.
View 1 Replies
View Related
Mar 21, 2006
I've built a pretty extensive database for work thanks largely to the folks on this board. But I'm stuck. I have a report to track inspections and it works fine, but I'd like to filter it down by AFSC (a coded expression the AF uses to denote career fields, i.e. 2A5x1x is Aircraft Maintenance.) The report's queries come from a couple of sources to retrieve the requirements for the report. For instance that AFSC has to start w/ "2A" and the labor code needs to start w/ "1" and not be "120". No problem. The problem I'm having is that the first 'x' (from the AFSCs below) is based on skill level (can be a 1, 3, 5, 7, or 9) and the last x is sometimes there and somtimes isn't.
For this particular report I've broken down the AFSCs down to three different formats. They are as follows:
2A5x1x (i.e. 2A531B or 2A571)
2A5x3x (i.e. 2A533A, 2A55B, 2A57C)
2A6(or 7)x1(or 2,3,4,5,or 6)
The report is designed to show who is due an inspection and it works fine. But I need to try to make it a little more user friendly so that all the various workcenters can trim it down to view just their career fields. Right now it reads from a query.
Here's the SQL for it.
SELECT qryPEDueUnion.[Main Assessee], [Employee List Table].[Employee RANK], [Employee List Table].[Employee NAME], [Employee List Table].AFSC AS FilterAFSC, [Employee List Table].[Labor Code] AS FilterLaborCode, qryPEDueUnion.[Inspection Type], Last(qryPEDueUnion.Date) AS LastOfDate
FROM qryPEDueUnion LEFT JOIN [Employee List Table] ON qryPEDueUnion.[Main Assessee] = [Employee List Table].EMP
GROUP BY qryPEDueUnion.[Main Assessee], [Employee List Table].[Employee RANK], [Employee List Table].[Employee NAME], [Employee List Table].AFSC, [Employee List Table].[Labor Code], qryPEDueUnion.[Inspection Type], Left([AFSC],2), Left([Labor Code],1)
HAVING ((([Employee List Table].[Labor Code])<>120) AND ((qryPEDueUnion.[Inspection Type])="PE") AND ((Last(qryPEDueUnion.Date)) Between DateAdd("m",-19,Now()) And DateAdd("m",-15,Now())) AND ((Left([AFSC],2))="2A") AND ((Left([Labor Code],1))=1))
ORDER BY Last(qryPEDueUnion.Date);
Let me know if you need more info. I'm new to posting on this board and haven't quite found out how to attach files....Plus this db is pretty big and I'd have to fool around w/ a copy of it first to make it small enough to attach.
View 3 Replies
View Related