In my form I have a subform, which displays A, B, C. Then information C is displayed in textbox. User should have a possibility to modify this data in order to modify data in database.
I am able to display information C in text box based on this subform. However it is uneditable, although property of enabled is yes and locked is no.
It seems to me, that it is impossible to edit data because it is taken not directly from database but from sub form, so I make special query which takes data directly from database however I lose an event which is based on selecting proper record from subform (there is only onEnter and onExit events)
Is it possible to make such things?
Thank you for any advices!
[ModEdit>>z{Merged post #2 by OP as follows}]
"I am able to display information C in text box based on this subform. However it is uneditable, although property of enabled is yes and locked is no."
I received a message "Control can't be edited; it's bound to the expression".
IMHO, You are making things too complex.
Rabbit hit the nail on the head (has the correct answer) as to why you can not edit the information directly in the textbox-C on the mainform.
You have a few options; however, none of them as easy as letting the user modify the data in the subform which is bound to the query. Otherwise you are stuck with a ton of vba.
With your current set-up (and I'm guessing)
Take txt-C and unbind it, remove the control source.
In your subform, in the on_current event, you will copy the current code to the txt-c,
In the after update event of txt-c you will need to check to see if the value in the subform matches the value in txt-c - if not then save the value in txt-c to the current record in subform.
Your Txt-A will need some simular code to work to alter what is in C. Clear as mud (Z-Z)... ?
11 3190 zmbd 5,501
Expert Mod 4TB
t seems to me, that it is impossible to edit data because it is taken not directly from database but from sub form,
It is more likely that your recordset for the subform is not from an editable source, at least for that field.
Please read thru: > Before Posting (VBA or SQL) Code
Then post your SQL for the subform.
I suspect they are using a textbox bound to an expression related to the subform and attempting to edit that bound control rather than the source data.
Thank You for a replay.
So, data in subfrom are editable.
SQL Code (no VBA, written in Record Source) for subPurpose: - SELECT qryPurpose.[ID Job Position]
-
,qryPurpose.Discipline, qryPurpose.Position
-
,qryPurpose.Purpose
-
FROM qryPurpose;
or without query it can be written: - SELECT [Job Positions].[ID Job Position]
-
,Positions.Position, Disciplines.Discipline
-
,[Job Positions].Purpose
-
FROM Positions
-
INNER JOIN (Disciplines
-
INNER JOIN [Job Positions]
-
ON Disciplines.[ID Discipline]
-
= [Job Positions].[ID Discipline])
-
ON Positions.[ID Position]
-
= [Job Positions].[ID Position];
and txtPurpose which is a text box: - Control Source:
-
=[subPurpose]![Purpose]
Rabbit,
How can I get data from database through text box, depending on selected position from subform and then have a possibility to modify them?
zmbd 5,501
Expert Mod 4TB
I'm with Rabbit on this,
Where exactly is this control "C" located in your forms.
There is a simple form with text box in Detail section and subform in footer section.
zmbd 5,501
Expert Mod 4TB
Please be specific:
The text box showing the information "C" is located where, main form, sub form 1, or some other form or location.
Thank You for patience.
The text box showing the information "C" is located in main form in Detail Section.
The sub form is located in the same main form in Footer Section. It takes data from query, but taking data directly from table makes no difference.
All I want is to modify information C based on selected A. My idea was to make a subform, where user can select A and because of length of information and aesthetic point of way display info C not in the same subform as A but in seperate Text box. Everything is going well apart the fact that I can't modify info C in text box.
It is possible to make another sub form with info C depending on sub form with info A, which can editable. So it will be probably the best idea, I just create a nice looking another sub form.
zmbd 5,501
Expert Mod 4TB
IMHO, You are making things too complex.
Rabbit hit the nail on the head (has the correct answer) as to why you can not edit the information directly in the textbox-C on the mainform.
You have a few options; however, none of them as easy as letting the user modify the data in the subform which is bound to the query. Otherwise you are stuck with a ton of vba.
With your current set-up (and I'm guessing)
Take txt-C and unbind it, remove the control source.
In your subform, in the on_current event, you will copy the current code to the txt-c,
In the after update event of txt-c you will need to check to see if the value in the subform matches the value in txt-c - if not then save the value in txt-c to the current record in subform.
Your Txt-A will need some simular code to work to alter what is in C. Clear as mud (Z-Z)... ?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jake_adl |
last post by:
Is there any way to create a
Microsoft.Practices.EnterpriseLibrary.Data.Database object without reading
from a configuration file?
I am writing a utility that manages databases in SQL Server....
|
by: Vijaya |
last post by:
Can we bind data to textbox in a headertemplate in a
template column of a datagrid?
If so please give some code snippets.
Thank you
|
by: luanhoxung |
last post by:
Hi all !!
i have met trouble with referring textbox of subform in VBA
i know i can do as: forms!mainform.subform.textbox
but i want do it in shorter path.
any suggestion about using variable ?...
|
by: panwala_bhavesh |
last post by:
I have a subform in continuous form style that I use to populate 3
fields (textboxes) on my main form with a double-click of the key-field
textbox of the sub:
Private Sub...
|
by: khyati30 |
last post by:
hi,
i am working on asp
i am facing problem in asp , combox
i want to retrive data in textbox , from combobox .
in combobox , when i select particular user , i want to fetch that regarding...
|
by: jain19801 |
last post by:
I Have Created Connection Object, Dataadapter And Fill The Dataset But Afterwards I Am Unable To Display The Data In Textbox Or Label
|
by: durga2005 |
last post by:
hi
im using webgrid control and i have used template columns to display the data from the database
while editing the data in webgrid, im storing the the new values in two strings for using...
|
by: jaredciagar |
last post by:
Hi Guys,
can You help me please in my project....
I'm using VB Script,ASP.Net,MS SQL Server 2005
I want to save data in gridview control from data in textbox control....
How can I Do It?...
|
by: reginaldmerritt |
last post by:
I have a few forms which i have designed to be subforms to a mainform that has no fields or record source.
The forms have an unbound textbox and combo box, which i use to seach the data on these...
|
by: arun3232 |
last post by:
how can i display data to textbox using sql server in asp.net with c#..
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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...
| |