473,394 Members | 1,750 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,394 software developers and data experts.

Access form and subform assistance needed

I am in need of assistance with an Access form. On my form I have a combo box and I would like the datasheet subform to populate with the data that is associated with my combo box selection. I know how to requery the data so that I get a dropdown list of the associated data but that is not ideal. Any assistance would be appreciated.
Jul 12 '07 #1
8 2214
hyperpau
184 Expert 100+
I am in need of assistance with an Access form. On my form I have a combo box and I would like the datasheet subform to populate with the data that is associated with my combo box selection. I know how to requery the data so that I get a dropdown list of the associated data but that is not ideal. Any assistance would be appreciated.

is your subform datasheet bound to a query or to a table?
it should be bound to a query then you just have to put a parameter which is equivalent to the value selected on your combobax.

Example:
you chose Record 1 on your combobox, then you want the datasheet subform
to show the data for Record 1 as well.
Then you put parameters to the query where the datasheet subform is bound.


Let's say your query has the Fields 'RecordNo' and 'RecordData'.
You go to the design view of the query and put this as a criteria

=Forms![Name of the Form]![Name of the combobox]

Then on the VBA code of the combobox, put these:

Private Sub NameOfComboBox_AfterUpdate()

Me![Name of subform].Requery

End Sub
Jul 12 '07 #2
my subform datasheet was bound to a table. But I changed it so it is bound to the query like you suggested. I entered the parameter as suggested and put in the VBA code. Unfortunately, it is still just giving me a drop down list with the related information and not automatically populating the datasheet.
I am going to insert an image of what I would like it to look like to give you an idea. I had to go in and manually select all of the criteria you see in the Error column. I dont want to have to do that.
Attached Images
File Type: jpg errorList.jpg (46.2 KB, 254 views)
Jul 12 '07 #3
hyperpau
184 Expert 100+
my subform datasheet was bound to a table. But I changed it so it is bound to the query like you suggested. I entered the parameter as suggested and put in the VBA code. Unfortunately, it is still just giving me a drop down list with the related information and not automatically populating the datasheet.
I am going to insert an image of what I would like it to look like to give you an idea. I had to go in and manually select all of the criteria you see in the Error column. I dont want to have to do that.
On this image that you posted, which of the combo box in the main form
will be selected to populate the datasheet subform? is the task or the task detail?

however, i don't see any fields in the subform datasheet that matches
the values in any of the 2 comboboxes. there should be at least one matching
field in order for this to work
Jul 23 '07 #4
On this image that you posted, which of the combo box in the main form
will be selected to populate the datasheet subform? is the task or the task detail?

however, i don't see any fields in the subform datasheet that matches
the values in any of the 2 comboboxes. there should be at least one matching
field in order for this to work

The way my tables are set up is that task is related to task detail and task detail is related to Error.
Therefore, once the task detail is selected I would like the subform to populate with the Error related to that task detail. Does this make sense? Was there more info you needed to assist with this? Thanks for your help so far!
Jul 26 '07 #5
hyperpau
184 Expert 100+
The way my tables are set up is that task is related to task detail and task detail is related to Error.
Therefore, once the task detail is selected I would like the subform to populate with the Error related to that task detail. Does this make sense? Was there more info you needed to assist with this? Thanks for your help so far!
sorry for the long wait.
The way I see it, you have to make sure that there are Primary and foreign key relationship between the task detail and Error, assuming they belong to two different tables.

let's say your task detail table should have a Primary Key named TaskDetailID, therefore your error table should have as well a Primary Key name TaskDetailID. Then you create a relationship with the two. now that they are related, you can quickly relate the error subfrom to your taskdetail form by using the TaskDetailID field as the Parent and Child Link Fields. You can do that by going to the design view of your form and pulling up the properties of your subform.

Again, the properties of the subform as a subform of the mainform. You can do that by double clicking the border of the subform instead of its form selector. Go to the Data Tab and choose TaskDetailID as the Parent Link and for Task Detail table, and TaskDetailID as the Child Link for the Error table.

does this make any sense to you?
Aug 1 '07 #6
sorry for the long wait.
The way I see it, you have to make sure that there are Primary and foreign key relationship between the task detail and Error, assuming they belong to two different tables.

let's say your task detail table should have a Primary Key named TaskDetailID, therefore your error table should have as well a Primary Key name TaskDetailID. Then you create a relationship with the two. now that they are related, you can quickly relate the error subfrom to your taskdetail form by using the TaskDetailID field as the Parent and Child Link Fields. You can do that by going to the design view of your form and pulling up the properties of your subform.

Again, the properties of the subform as a subform of the mainform. You can do that by double clicking the border of the subform instead of its form selector. Go to the Data Tab and choose TaskDetailID as the Parent Link and for Task Detail table, and TaskDetailID as the Child Link for the Error table.

does this make any sense to you?
Most of what you are saying is making sense. I almost think I already have that going on. I would like to get you a copy of the database so you can look at it. Just the screen print alone was not adequate to get a clear picture. I am not sure if there is a way to attach it here. Let me know if you know of a way for me to do that.
Aug 1 '07 #7
hyperpau
184 Expert 100+
Most of what you are saying is making sense. I almost think I already have that going on. I would like to get you a copy of the database so you can look at it. Just the screen print alone was not adequate to get a clear picture. I am not sure if there is a way to attach it here. Let me know if you know of a way for me to do that.
send me an email and attach it there. my user preference here in the scripts is set to accept emails. :)
Aug 2 '07 #8
Looks like it isnt set up to receive emails at this time.
Aug 7 '07 #9

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

Similar topics

7
by: Julia Baresch | last post by:
Hi everyone, My company recently upgraded from Office 97 to Office XP. As those who've read my other posts know I have a database with 3 nested subforms Main form-->First Subform-->Second...
0
by: Josh C. | last post by:
Hello everyone. I'm a bit of an Access newbie, so please bear with me. Please go to http://www.dumoti.com/access/ to view the database - 536kb. I'll go straight into examples: In the form...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
2
by: Jan Szymczuk | last post by:
Thanks again guys, for your recent assistance. Now as you were so kind to assist the first time (the solution was so simple and elegant) I was wondering if you could assist with another couple of...
11
by: musicloverlch | last post by:
I have a form with a subform that has a subform that has a subform that has a subform. The 5th embedded subform never opens in Access 97 and I get a message that 'a form has caused 1 error.' When I...
3
by: stuart.medlin | last post by:
I have an Access 97 application that has a basic form (Transcript) and subform. The subform has a query as a recordsource that returns records from a table: SELECT DISTINCTROW Transcript.NCID,...
0
by: LEX | last post by:
I Have A Simple 2 Table Database. I Have Created A Form With A Subform, Works Ok. Boss Wants An Online Form So That People Can Update Own Records,(training Records, Skills Etc). Created Access Data...
6
by: solom190 | last post by:
Okay this is the situation I have two forms and they have a 1:M relationship. I don't have enough space screen-wise to do a traditional "drag form to form" to create a subform so what I did was...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
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,...

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.