Setting Controlsource Propert In VBA
Jan 28, 2008
I am trying to set the controlsource propert within VBA for a combo box
S_SECTCOSTCENTRE is the field name I want to set.
My syntax below doesn't work can anyone help
cmbcostcentre.ControlSource = "S_SECTCOSTCENTRE"
thanks paul
View Replies
ADVERTISEMENT
Feb 2, 2014
In my application I have continuous form with unbound textbox. In OnOpen form event I change ControlSource property of textbox to one of the fields (e.g. "Kol921") in forms recordset. In form footer I have another unbound texbox where I defined ControlSource property as "=Sum([Kol921])".
Values in fields shows correctly, but in "sum" textbox I get Error.
When I get through code in debugging mode (with F8 key), value in "sum" texbox shows correctly, but when I open form normally I get an Error in that textbox.
Here is part of code:
Me.Controls("mat1").ControlSource = "Kol921"
Me.Controls("mat1").Visible = True
Me.Controls("matSum1").ControlSource = "=Sum([Kol921])"
Me.Controls("matSum1").Visible = True
View 2 Replies
View Related
Jul 16, 2007
I have made it before but I dont know why it doesnt work this time:
I have a main form called:[LeavesEditorMain]
It contains subform called:[LeavesEditorTmp]
I want to programmatically set the [LeavesEditorTmp] scrollbars property to 0 (Neither) or 2 (Vertical) according to the value of number of records ot a tables called LeavesTmp. I wrote the code as follow in the On Load event of the [LeavesEditorMain] form
if dcount("*","[LeavesTmp]")>6 then
[Forms]![LeavesEditorMain]![LeavesEditorTmp].Scrollbars=2
else
[Forms]![LeavesEditorMain]![LeavesEditorTmp].Scrollbars=0
endif
the error I got is: the property or method is not supported by this object!
View 2 Replies
View Related
Dec 13, 2007
I have a unbound text box being used as a label. In the control source of the text box I have a date ie. =#12/31/2008#. I am using this date for criteria in a dsum function, so whatever date is in this field effects the data being displayed. I need to be able to have the user edit this date when necessary. I created another unbound text box and put the following code in the after update: Me.ReestDate.ControlSource = "=#" & Me.EnterReestDate & "#"
This is working as it is displaying the correct change. My problem is that the control does not retain the date. When I exit out and go back in, the original date is still there. Is there some code that will save the field after I update it? Or maybe another suggestion to do what I need.
Thanks
Gregg
View 3 Replies
View Related
Aug 19, 2004
I am trying to set a ControlSource for a textbox to a string what is the correct syntax?? I am also trying to set a record source using DLookup, this is also not working. Could some look at my syntax an correct me.
Reports(!strReportName)!txtClientName.ControlSourc e = "All"
Reports(!strReportName)!txtClientName.Value = _
DLookup("[ClientName]", "CLientIDs", "ClientNumber = '" & _
Forms!frmReport!txtCustom1 & "'")
thanx
View 2 Replies
View Related
Aug 29, 2005
I have a form. The form is bound to an underlying query which is a left join between two tables. (SELECT ... T1 LEFT JOIN T2 ON T1.RID = T2.RID ....)
Now, what I want to happen is the value in T1.RID does have a match in T2, then I want a sequence of text controls to be bound to fields from T2, otherwise I want them to be bound to fields in T1.
I almost have it working. I have Form_Current() and T1_RID_Change() both calling a routine
sub BindControls()
if isnull(T2_RID.value) then
txtField1.Controlsource = "T1.Field1"
txtField2.Controlsource = "T1.Field2"
' etc for each field
else
txtField1.ControlSource = "T2.Field1"
txtField2.ControlSource = "T2.Field2"
' etc for each field
end if
end sub
The problem is that when I change the value in T1.RID, most of the times it does change the controlsource appropriately. But other times it lags. It keeps the wrong controlsource until I try changin RID again, and sometimes the text boxes are just blank, so I am not sure what is going.
Am I ultimately going to be able to make this scenario work?
Thanks,
David
View 2 Replies
View Related
Feb 20, 2008
I want to design a common Search Form which should read records from different table sources and populate a sub-form depending on the user preference. The recordsource of the form should change to point different table or query name depending on user option.
Similarly, the underlying text controls should have their control sources changed to appropriate field in the table selected.
How is this done in run time.
For example, I have two tables and forms (1) for Currency (t_CurrcyMas) and (2) for User details (t_USerMas). I have search form named frmSearch. This has criteria defined as txtCri1, TxtCri2. Depending on the entry of criteria, matching records should be displayed as continuous form in two text controls named txt1, txt2 under sub-form frmSubSearch. The recordsource of the form.frmsearch should be changed to t_CurrcyMas and control sources of Txt1, Txt2 to be changed.
WHat is the syntax for this, and in what event do I insert the codes.
View 5 Replies
View Related
Nov 4, 2005
I have a form with two subforms. One of the subforms has five subforms (subsubforms).
The ControlSource and the (query sequence for each) RecordSource of each of the subsubforms are created on-the-fly. The subsubforms have no Master/Child relationships specified. The subsubform merely display various filtered and various grouped subtotals of the 1st subform. Summing and grouping on the subsubforms prevents my using Master/Child properties.
On the AfterUpdate event on any of the filter fields on the form the ControlSources and RecordSources are rebuilt and the form becomes invisible for some reason and appears to hang, even after stepping through all the (class module) code with the debugger. Repeadedly clicking both Maximize and Restore buttons on the form's button on the Status Bar followed by clicking a 2nd form's toolbar icon causes the form to become visible under the 2nd form. The tool bar are also not visible, just a large brow bar at the top of the form. Moving the mouse over the toolbars causes individual icons to become visible or raised.
What am I missing?
Maybe I should calculate the values using DAO recordsets and backfill unbound subsubforms.
Thank you in advance for your thoughts.
View 1 Replies
View Related
Mar 31, 2008
I have a combobox that selects the customer and shows related information on that customer such as phone number, cc#, etc..
now the trick is i need to allow the selected member to be added to the order information.
For instance, the user selects the customer "Bob" and bobs information is displayed to check for accuracy. After the info is approved the user will continue to process his order. In order to do this I need the customer ID to be the same as the selected customer in the combobox.
Then the user will proceed to fill out the order information, location, date, time, etc.
How can I go about doing this?
Thanks in advance
View 2 Replies
View Related
Jun 11, 2013
I have multiple reports that use similar IIF statements as the controlsource for four textboxes. Naturally, I don't want to have to update twelve controlsources if any of the calculations change, so I thought I'd make this a public function. However, I don't know how to pass along multiple textboxes as variables. Here's what I have so far:
Code:
Option Compare Database
Public Function txtColor(ByRef textbox As Control)
Dim str1, str2, str3, str4 As String
'The IIf statement is simplified for this example. It's not important.
str1 = "=IIf(IsNull([Inquiry start date]),'W',IIf([txtInquiry]<1 And IsNull([Inquiry end date]),'R'))"
[Code] ....
And this is in the report (where ??? is what I'm asking about)
Code:
Private Sub Report_Load()
Call txtColor(???)
End Sub
The error I get is "Runtime 424 Object Required"
View 7 Replies
View Related
Feb 15, 2007
Hi Guys,
ok I work a lot on databases but have recently been asked to set up an access database for my team. We are a marketing team within a large insurance company and need a small access database for MI and project management.
I have made a start on this and going well so far but there are some things I need it to do that I dont know how :P
Ive never messed about with Acess before so bare with me :P ok so this is what im looking for, any help would be greatly appreciated.
I have set up various tables for look up wizards for some of the menus on another table I designed for the raw data entry.
I need two tables, two forms - one table for very basic generic data such as
- Job Number
- Description
- Business Unit
- Owner
- Due Date
- Completion date
I then need to drill down into this to add more information, so its basically two tables on top of each other with co-dependencies.
So for example one of my team enter a new project at the very basic lvl, they have a job number, they know what business unit it is for and they know the date its due, as time goes by and work is done on the project I want them to be able to click on a button that takes them to another form where they can enter information that is linked to the original information.
So they search for job number 00000 and come up with the above data on the first form, I want them to then click on 'Project Information' button and be taken to another form that has a lot more stuff on there, like a description, complications, notes, links to documents etc etc. I tried to do this linking two tables together but it doesnt work as the two forms/tables are not co dependend and are irrespective of each other.
Does this make any sense ? and does anyone know how I might make this work ? Please let me know if I am not clear and I will try to explain as best I can
I would also like to change the form 'theme' aswell and have my companies logo transparent behind the data fields etc, anyone know how to do that as I only have the option to use the standard themes.
Any help would be greatly appreciated
Sleek
View 1 Replies
View Related
May 29, 2007
hi there,
Hiow can i make my access database to open the database window on pressing F11?
Thanks
Danny
View 14 Replies
View Related
Jun 22, 2005
Is it possible to set which VBA reference boxes are ticked each time a database is loaded?
A problem is created when a person amending the database to the person using it has different setups and so some of the references show as "missing" and so compile errors show on loading.
We are using Microsoft Access 97.
Any help most appreciated.
Dalien51
View 1 Replies
View Related
Apr 10, 2006
Hi
I have 6123 records in a database.
I need a report that prints the Customer ID and the Postcode
I have managed to do this but it comes to 196 pages!
Is there n e way i can format the report so instead of it being like this:-
Customer ID Postcode
2334 LS89 8UJ
2333 BD67 990
It displays multiple lines on each page .eg
Customer ID Postcode Customer ID Postcode
2334 LS89 8U 2354 LS69 8YH
2333 BD67 990 7899 BH78 6NQ
Can anyone help??
View 5 Replies
View Related
Apr 25, 2006
I made on option box on a form called Status. The 2 radio buttons are marked Open = 1 and Closed = 2. Is it possible to open a query based on what the user selects. In the query I want open to stand for Is Null and closed would be Is Not Null. I know this sounds unusual but it works in the query they way I want it to. Is this possible? Thanks...
View 2 Replies
View Related
Jul 18, 2006
How do I change an AutoNumber that will output 1, 2, 3 to output 0001, 0002, 0003??
Thanks
Jessie
View 11 Replies
View Related
Feb 14, 2007
I tried various searched and came up empty handed.
I have a user that is using a database that is on a network. When she enters records using her computer and exists the database, they don't save. If she goes back in, they aren't there. However, if she uses another computer, they save.
I can assume that it's not user error because it's the same user on two different computers.
Any ideas?
View 7 Replies
View Related
Mar 4, 2007
I am confusing myself more and more as i read on normalization and queries and everything else. I am trying to create a database for parts that our company sells and am having trouble deciding how to lay out the tables. I figure I should use the part number for the primary key as it will not repeat. from there though, i have a problem, each type of part has different fields nessesscary to decribe its attributes. for example, one part number may be for a box and its describing fields might be brand, width, length,load rating, and height. but another part number might be for a circuit breaker which would have completley different describing fields like brand, amperage rating, voltage rating, connection type, and trip type. Should i create 1 table for everything even though many fields would be blank depending on which type of item it was or should i create seperate table for each type of item with only the required fields to decribe that item?
View 14 Replies
View Related
Jan 17, 2008
Hi,
i have a subform within a form. when the form is loaded, i would like the subform to automatically be ready for a new record instead of shown the last record entered. i have tried various macros ( not VB ) but to no avail. the form shows the persons info and needs you to add a certain piece of info. this would be the only reason for the form.
can it be done?
NS
View 1 Replies
View Related
Apr 11, 2008
Hi everyone,
how would i go about setting focus on a tab control? i have a tab control on a form with 6 tab pages. i am on page 4 ( bank ) and i have a button to add a bank account. this opens up the add form and i add the account. i then requery the form and the tab goes back to page 1. how do i set the focus back to the previous opened tab?
many thanks,
Nigel
View 2 Replies
View Related
Apr 18, 2006
Dear all,
i have having such trouble setting up some tables in a new db, and am wondering if someone could give me some tips as I really don't know what I'm doing (I am new to this).
I have one main table, called Client Information. The PK is CaseNumber. I also have 11 other tables. The PK in each of these is called things like CasedetailsID, witnessinfoID, etc. Each of these tables contains the CaseNumber field (supposed to be from the Client Information table). The Client Information table contains the PK from each of the other tables.
The way I have the relationships set up at the moment is that the Client Information Table is linked to each of the other tables via the fields called casedetailsID, witnessinfoID, casetypeID, etc. The relationships are all one to many (the 'many' side being on the Client Info table, the 'one' side being on the related tables). There is obviously something incorrect about the way I have the tables set up, however, as when I try to enter data into the form, although the data gets stored in the individual tables, none of my queries or reports seem to be working (ie, I try to run a report, but it doesn't show any data).
any tips or advice regarding a good way to go about setting up tables and relationships would be very much appreciated.
View 3 Replies
View Related
May 11, 2007
17412 Hi, I am trying to set up a database for organizing Track and Field meets. I'm a newbie to a lot of the Access capabilities. I've attached a PDF of what I'm looking at doing for my Access tables. Some of the tables I think I have right. I don't know how to organize the meets, events, days. Should I have a table for each event? Can you look at my tables and give me advice on problems you can see? In the end I would like to enter the event results by race. Some races could have 10 or more heats. There are also field events that have different number of attempts depending on the meet. There are different track meets with different events each time and the order in which the events occur changes from meet to meet. Any help or advice you can give me would be great. Thanks!
CK
View 1 Replies
View Related
Nov 9, 2007
Hi
I feel really stupid for asking this, but I am so stressed at the moment, I can't concentrate!
I have a database that stores land locations and information relating to it. In the database, I need a form that asks 13 questions and answers are given in drop down boxes (about 3 answers to each question). Each of these answers relate to a score, which I want to be able to show automatically.
What I would like to know is how to set the table for it. This table has to use the ID from the land locations table (which is sorted by the way).
Please see the attachment for a simple design of what my 'boss' wants it to look like. The form for this table will be a subform on the main form for land locations.
Please can someone help me? I would really apreciate it :)
View 2 Replies
View Related
Dec 16, 2005
hi
i've joined two tables and have some null values .....
I want these null values to be 0 to be used in a calculation
anyone got any ideas how i could do this
cheers
Andy
View 1 Replies
View Related
Feb 9, 2006
in a frontend/backend configuration is it necessary to set relationships in both or do relationships only need to be set in the backend file ?
thanks
View 1 Replies
View Related
Mar 27, 2006
Hi,
I have a table I am trying to set up a query. I got into the query and set up the fields as follows: Name, Address, Landlord, Lease Date, 90 Day Reminder, 30 Day followup.
I want to show all these columns in my query. I need to set up formulas for the 90 Day Reminder and the 30 day followup from the Lease Date field.
The 90 Day Reminder is the date 90 days prior to the Lease Date, and the 30 day followup is 30 days after the lease date.
I am having trouble setting up the formulas. I did it in design mode, and I tried filling in a formula and when I tried going into the dababase mode, it asks for for a parameter. I am having difficulty understanding what to fill in for the parameter. I am not sure about the formulas either.
Can someone help me???
Thanks,
Marilyn
View 1 Replies
View Related