473,586 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing the control source of a textbox

20 New Member
Hi All,

I have many buttons on a form, i want each of these buttons to open the same form but change the control source of the textbox on the form so i can use it to update multiple fields and not have to create a bunch of forms to do the same thing. All of the fields being updated are on the same table, the control source of the update form is a select query which is based on that table.

my current code is this:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenQuery "qry_Credits Notes"
  2. DoCmd.Close acQuery, "qry_Credits Notes", acSaveYes
  3. DoCmd.OpenForm "frm_Credits Notes"
  4. [Forms]![frm_Credits Notes]![Project Number] = Me.Project_Number
  5. [Forms]![frm_Credits Notes]![Notes].ControlSource = "= [Forms]![frm_Credits Notes]![SS 2]"
  6.  
only the bottom line is to do with this problem.

My problem is that after i change the control source when i try to enter data in the text box i get a beep and the bottom bar displays

"Control can't be edited; it's bound to the expression '[Forms]![frm_Credits Notes]![SS 2]'.

any ideas on how i can change the control source and still enter data in the textbox?

let me know if anything's unclear.

Thanks,

X
Aug 20 '14 #1
16 6984
twinnyfo
3,653 Recognized Expert Moderator Specialist
Try this:

Expand|Select|Wrap|Line Numbers
  1. [Forms]![frm_Credits Notes]![Notes].ControlSource = [Forms]![frm_Credits Notes]![SS 2]
This should assign the value and allow edits.
Aug 20 '14 #2
Xenver
20 New Member
Thanks for the response!

When I exclude the quotes and double equals like you have above I get a error:

Run-time error '13': Type mismatch


Thanks.
Aug 20 '14 #3
twinnyfo
3,653 Recognized Expert Moderator Specialist
Opps - my mistake.

Expand|Select|Wrap|Line Numbers
  1. [Forms]![frm_Credits Notes]![Notes] = [Forms]![frm_Credits Notes]![SS 2]
But, no double equals - just one.
Aug 20 '14 #4
Xenver
20 New Member
I probably should have mentioned that the notes form, "frm_Credit s Notes" is a continuous form. When i use the above code all the textboxes update to mirror each other and the text i enter doesn't show up in the table.

Thanks,

X
Aug 20 '14 #5
Xenver
20 New Member
twinnyfo,

Thanks so much for your help on this and my past questions, i managed to figure out the code i need by messing around a bit, i got this:

Expand|Select|Wrap|Line Numbers
  1. [Forms]![frm_Credits Notes]![Notes].ControlSource = "[SS 2]"
working after i realized that there was no item on the form named SS 2, that item is in the query.

Thanks again, im sure I'll have more questions in the future!

X
Aug 20 '14 #6
twinnyfo
3,653 Recognized Expert Moderator Specialist
Yes, continuous forms will update all records.

On a side note, I am curious why you want to automatically update the value of this field if you also want to edit it manually...
Aug 20 '14 #7
Xenver
20 New Member
I'm not updating the value of the field, I'm updating the fields control source. The textbox is being used to enter notes/comments on various project credits, i want to update its control source so i don't have to make about 50 forms ( that'show many credits i have) that perform essentially the same function.
Aug 20 '14 #8
twinnyfo
3,653 Recognized Expert Moderator Specialist
I guess I'm not following exactly what you want to do.... And why. I don't understand the reason behind constantly changing the control source of a text box. If you have multiple fields that have essentially the same data, why not just use one field?

In terms of database design, there is no value in that.
Aug 20 '14 #9
Xenver
20 New Member
Ok, to help you understand why i wanted to do this i'll start by giving you a little context about what the database is actually for.

I work for a large engineering company, many of the buildings we design pursue certification under a system called LEED. LEED is a green building rating system which helps to encourage environmentally friendly building design. Basically to achieve LEED certification you have to implement certain design features in the building, water use reduction, energy efficiency, occupant comfort measures, etc. the things you can do to achieve LEED certification are broken down into credits, achieving each credit will grant a certain number of points, and the amount of points a building recives determines if it can be LEED certified, and what level it can be certified at (certified, silver, gold, or platinum).

Because of the large number of LEED buildings we design we want to track the credits each project pursues and if they are successful in achieving them, and if they are not successful, why. The form which has the buttons is used to enter the points being pursued on each credit for a single project, there is a "Notes" button for each credit. I wanted to change the control source of the text box so that when the "Notes" button on each credit is clicked it would open the notes form and the user could enter notes which would be stored and associated with the correct credit.

So, I don't have multiple fields with essentially the same data, the notes on each credit will be different, i just didn't want to have to create a form to make notes on each credit.

Hope that helps to clarify my purpose in this.

Thanks,

X
Aug 20 '14 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2130
by: Geoff Matthews | last post by:
I apologize for the basic question, but MS's documentation has been no help at all. I'm working on a database, and need to create a form for schedules, M-F, 8-4. I've settled on an easy way out, by creating 5 similar tables (Monday, Tuesday, Wednesday, etc.) with the same fields (8, 9, 10, etc.) that link up to one table (Schedule) and then...
9
7412
by: Jack | last post by:
In the control source of a textbox, is there a way to refer to a column of a combobox? For example: =.Column(2) Thanks, Jack
1
1496
by: Bart Lateur | last post by:
In an Access form, I'd like to show the status on whether an item as entered in a textbox (and thus in its coupled record field) exists in a list in another table. I've tried: - Making the record source of the form a query, like select a.*, b.barcode is not null as from a left join barcodes b on a.barcode = b.barcode but as a result,...
1
1300
by: anuradhacv | last post by:
When can we give control source of a textbox =1?
2
1646
by: SF | last post by:
Hi, I am new to VB.NET. I try to start my first project linking to an Access database. On my Form1, I have two fields (bound), Subject and Author. This was done by draginf the table into the form. Since the author name are mostly the same, I want to change this field to a dropdownlist but I do not know how!. In Access, I just right click...
1
1639
by: questionit | last post by:
Is it possible to set the control source of a textbox to more than 1 field from 1- single table ? 2- more than 1 table ? Thanks
6
5075
by: colin spalding | last post by:
Access 2003 I subform which lists financial transactions for a client in the main form, which i total in a textbox named "txtTotalPremium" in the subform footer with the Control Source "=Sum()"; without quotations of course. This works fine until the subform has no records to return in which case textbox is blank. That would be fine...
4
2790
by: colin spalding | last post by:
Access 2003 I posted this last week; unfortunately, none of the suggested solutions cured the problem I have a subform which lists financial transactions for a client in the main form, which I total in a textbox named "txtTotalPremium" in the subform footer with the Control Source "=Sum()"; without quotations of course. This works fine...
4
13933
by: Lou O | last post by:
Is it possible to use the row (index) of a list box as control source Property for a text box? Example: Text1.ControlSource Property is set to "= List1.Column(0,2)" in design view. When I open the form, Text1 does not display the value of List1.Column(0,2) Am I missing something?
15
40635
beacon
by: beacon | last post by:
Hi everybody, Using Access 2003. I'm trying to dynamically set the record source for the current form and set the control source for a text box to input data to one of three tables. I have a form (frmAddNewUser) that will add users to one of three separate tables (tblDefsAFP, tblDefsMSU, tblDefsWF) based on the selection of an option...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8216
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.