473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

editing in Sub form after record source is set using combo box

Hi,

I have a form with subform in which I made a combo box through which I am populating 2 fields in sub form using SQL query from a table which has multiple rows. There are 3 more fields in sub form which i left for manual entering the data. I am facing issue when the data of first 2 fields get populated using combo box function then when I enter data in any rows of next 3 fields it gets auto populated with same value in all rows. I want to allow editing of each rows seperately. Can someone please help me with this issue?
Oct 24 '19 #1
3 1571
NeoPa
32,556 Expert Mod 16PB
Hi Ravgarwa. Welcome to Bytes.com.

It looks like you have three Controls that are unbound, but you're expecting them to behave as bound ones. Check out Why Values in Unbound Form Controls do not Persist.

Unfortunately, your explanation isn't very clear so it's hard to tell what it is you're actually trying to achieve with this. Maybe if you could explain your requirements a little better someone may be able to give suggestions as to how to get what it is you'd like to have. For now though, that would be difficult without understanding what you're trying to explain. Perhaps a little more time & effort writing it out would be helpful.
Oct 24 '19 #2
Hi Neopa,

Yes you are correct that I have 3 unbound controls in the subform.

I am creating a attendance recording form in which I have a combo box for Manager which will fetch the employee list from employee table in subform. So employee Id and name are the fields which are coming from query for record source. Post that other 3 fields are date, attendance and leave type are fields which I will update for all employees based on requirement. Below is the coding details:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command6_Click()
  2.  
  3. Dim selSQL As String
  4.  
  5. selSQL = "SELECT TLData.TLWINID, EmployeeData.WINID, EmployeeData.EmployeeName " _
  6. & "FROM TLData INNER JOIN EmployeeData ON TLData.TLWINID = EmployeeData.TLWINID " _
  7. & "WHERE (((TLData.TLWINID)=[Forms]![Attendance]![cboTLWINID])) " _
  8. & "ORDER BY TLData.TLWINID, EmployeeData.WINID "
  9.  
  10. Me.sfmAttendance.Form.RecordSource = selSQL
  11. Me.sfmAttendance.Form.Requery
  12.  
  13. End Sub
Oct 24 '19 #3
NeoPa
32,556 Expert Mod 16PB
ravgarwa1:
Post that other 3 fields are ...
No idea what this is supposed to mean. I'm guessing you didn't read your post before submitting it again. It will be very hard to help you if you don't put the basic effort in. I can only guess what you mean, and as it seems you're quite inexperienced that's even harder. I can see what makes sense but I can't follow the logic if there is none.

That's fine. We all have to start somewhere. There's nothing wrong with being inexperienced - it just means that your explanation is more important. Without it making sense it's very hard to advise you how to handle your problem.

My guess is that you have three unbound Controls on your Form (Date, Attendance & Leave Type) that you want to save somewhere. If so then you need to include the Fields from the table where they should be saved in the RecordSource of either your main Form or one of the Subforms. IE. They must be bound Controls.

I can help with one tip that is certainly relevant from looking at your code - Setting the RecordSource property runs the query immediately. There's no requirement to run .Requery(). It often does very little harm but for slow queries it can increase the response time for the user. It basically runs the same query twice so it makes sense it will take longer.
Oct 24 '19 #4

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

Similar topics

1
by: Sham | last post by:
I have a form that is used for entering data. The problem is I have several tables, so I need some way to change the form's record source via combo box. 1. How can I make the combo box look for...
0
by: Chandru Ra | last post by:
Hi.. Please urgent... Give me the code for this problem..
1
by: Whiteeagle | last post by:
Hi all I have inherated a bit of a dilema and not sure about the correct way of solving the problem. The company I work for have 60 identical but seperate databases which are all in seperate...
2
by: Bob Sanderson | last post by:
I want to select a Job Number and Revision from a combo box (cboSelectBOM). I then want to open a form (frmBoM) and display the record for that Job Number and Revision When I double-click on the...
1
by: thread | last post by:
Hi i built a form that getting dynamic SQL string,the SQL string is placed in the record source when the form is opened. i notice when trying to reduce some proccess time from the form that it...
5
by: Cyd44 | last post by:
I am trying to open a form to show all records which relate to the Logged in User only for a given date. My form record source is linked to the table and I want to set a condition where the Table...
8
Teresa Kline
by: Teresa Kline | last post by:
I have a form with a combo box. In the combo box is a list of tables in my database. I want to be able to select a table from my combo box and based on that selection open another form that uses...
4
by: NarenKeer | last post by:
Hi, I have been trying to find a solution for this from past one week and no good progress yet. I just want to avoid the parameter window displayed by query in record source property of a...
1
by: fspad59 | last post by:
I am using a parameterized query as the record source for an Acces form. If I run the query in Query builder it asks for the parameter value and then runs the query successfully. If I open the form...
3
mjoachim
by: mjoachim | last post by:
I am trying open a form from VBA to view a record that was moved from the original table to an Archive Table. I am having a hard time changing the record source of the form to look at the Archive...
0
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
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
marktang
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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,...
0
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...

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.