473,406 Members | 2,293 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,406 software developers and data experts.

Datasheet wont populate

Hi Guys

I am developing a programme to run off MS ACCESS, and eventually MS ACCESS Runtime, however, I do you a problem. I have created a form with 3 subforms on it. I have populated 2 of these subforms successfully, now I am trying to populate the 3rd subform which is a new form (frm_WeightBrowser) which contains its own subform (3rd level subform called frm_WeightGrid). This subform is a datasheet which I want to populate dynamically. I am trying to populate simply for now, and using the following code:

Expand|Select|Wrap|Line Numbers
  1. Public Sub LoadRecords(ID As Integer)
  2.     Dim SQL As String
  3.  
  4.     SQL = "SELECT * FROM [Weight]"
  5.     Me.Form.RecordSource = SQL
  6.     Me.Requery
  7. End Sub
  8.  
This code resides on the datasheet form (frm_WeightGrid), but it just won't work. I also tried

Expand|Select|Wrap|Line Numbers
  1. Me.Form.Recordsource = "Weight"
  2. Me.RecordSource = "Weight"
  3. Me.RecordSource = SQL
  4.  
Can someone please help me out here. I cannot see what I am doing wrong.
May 13 '14 #1
14 1986
Seth Schrock
2,965 Expert 2GB
How are you calling your code? It isn't in any event, so you will need to call it from an event procedure.
May 13 '14 #2
I am calling it from one of the other 3 subforms with the following code:

Expand|Select|Wrap|Line Numbers
  1. ...
  2.     Form_frm_TabPageControl.l_WeekNo.Caption = Nz(DMax("[WeekNo]", "[Weight]", "[ID] = " & ID), 0)
  3.     Form_frm_Weight.GetInfo ID, Form_frm_TabPageControl.l_WeekNo.Caption
  4.     Form_frm_WeightGrid.LoadRecords ID
  5. End Sub
  6.  
I do know it is working properly, as I tested by returning a simple msgbox in the frm_WeightGrid.
May 13 '14 #3
Seth Schrock
2,965 Expert 2GB
When you say it doesn't work, what does it do? Do you get an error message or does nothing happen or does it return unexpected results?
May 13 '14 #4
Nothing happens, no results, no error msg, not even column names. There should be data as the "Weight" table holds 290 Records in it.
May 13 '14 #5
zmbd
5,501 Expert Mod 4TB
"3rd level subform called frm_WeightGrid"
Is the issue yes?
Is this bound to the 2nd level via parent/child fields?
May 13 '14 #6
Seth Schrock
2,965 Expert 2GB
Are you using code to bind the controls in the subform to the record source? When you say "not even column names", it really makes me wonder what you are trying to do as changing a record source doesn't automatically create column names. That would have to be changed manually. The more I think about your question, the more I'm realizing that more information is needed to understand what you are trying to do.
May 13 '14 #7
Hi zmbd, none of my forms are bound to the parent form. They are all unbound
May 13 '14 #8
Hi Seth

Is there a way i can send you my accdb file and you can have a look and see what I am missing?
May 13 '14 #9
Seth Schrock
2,965 Expert 2GB
Are the controls within your third subform (the one that is having the problem) bound?
May 13 '14 #10
Hi Seth,

Nothing is bounded, if I could attach the screen prints, I could show you the forms. But here is the basic layout if it helps:
Main Form: frm_TabPageControl
frm_TabPageControl Sub Forms:
1. frm_CustomerBrowser (Contains a listbox and combobox, everything works fine)
2. frm_Weight (Contains mostly text boxes with data, that is defined by a selection from frm_CustomerBrowser. A routine in frm_CustomerBrowser calls a routine in frm_Weight which populates these text boxes. Everything here works fine)
3. frm_WeightBrowser (Contains only a rectangle for the background and a subform inside)

frm_WeightBrowser subform is frm_WeightGrid which is a simple data sheet, which is suppose to return data depending on the selection from frm_CustomerBrowser. This data can be fetched from the table called "Weight" based on a column called "ID". This is what is not working.

As you can see, I have no need for this form to be bounded. I pass the ID to this form, and all I want to do is run a query that says:
Expand|Select|Wrap|Line Numbers
  1. "SELECT * FROM [Weight] WHERE [ID] = " & ID
  2.  
I hope this helps. Thanks in advance.
May 13 '14 #11
zmbd
5,501 Expert Mod 4TB
In the form you are having issues with:
In one of the controls that you want to have the data from
"SELECT * FROM [Weight] WHERE [ID] = " & ID
displayed in...
Open the properties for that control
On the data tab
What is the entry for "Control Source" ?
May 13 '14 #12
This is access 2010 so there is no control source, but here are the settings on the Data tab for the frm_WeightGrid form (the datasheet):
Record Source:
Recordset Type: Dynaset
Fetch Defaults: Yes
Filter:
Filter on Load: Yes
Order By:
Order By On Load: Yes
Wait for Post Processing: No
Data Entry: No
Allow Additions: Yes
Allow Deletions: Yes
Allow Edits: Yes
Allow Filters: Yes
Record Locks: No Locks

I must also add, that I did try putting simply "SELECT * FROM Weight" in the Record Source and it still did not work.
May 14 '14 #13
zmbd
5,501 Expert Mod 4TB
I was inquiring about the control on the form (i.e. a textbox or combobox, etc....) not the form itself.
All controls will have a "control source" as they are either bound, undbound, or calculated.
May 14 '14 #14
Hi Guys

I actually have found a solution. It looks like Datasheets are fussy, but the following link helped me get to a solution:
May 14 '14 #15

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

Similar topics

13
by: Aladdin | last post by:
I have an MS Access form on which I have a listbox listing tables in that database. I want to be able to click on any of those tables and view its contents on the same form using subforms or any...
1
by: Knud Rogilds | last post by:
I have tried everything, what am I doing wrong? I have a data entry form in datasheet view (for mass data entry). One of the fields are SalesID, and I would like to use DLookup to populate an...
5
by: chrisse_2 | last post by:
Hi, I need some help. I have created a form where there are 3 combo boxes and a text box to search through records. Based on what the user fills in, you then it a "go" button to run the query...
1
by: DSR | last post by:
Can anyone tell me how to do this? I have a table (TableBuildings) that I want to auto create data to its sub datasheet (TableDaysOfWeek) whenever a new record is added to the parent table (one to...
1
by: s_wadhwa | last post by:
Hi, I have a main form "frmBldgFloor" and SubForm within the main form "fsubBldgFloor". In the SubForm the values in the text fields are being populated from a recordsource. I have these...
0
by: Rich | last post by:
Hello, I started using the Reportviewer control (very nice) for generating Reporting Services type reports in my VB2005 app. I have been experimenting using a designer Reportviewer control from...
2
by: adriann | last post by:
Hi. This code works fine in IE, but absolutely nothing - zip - zilch happens in Firefox. Not even an error message. An item from a drop down menu is selected, which calls the JS function, which then...
2
by: ruthboaz | last post by:
Hi, My database is in SQL Server with Access as front end. I have a Microsoft Graph Chart for which the data is picked up with a query from the SQL Server. In the DataSheet the first row is...
6
by: Savita23 | last post by:
I am trying to pass a query string from the main form to subform to display records in datasheet view.I tried using the following code in the form_load() event to populate the subform(Child0) ...
7
by: prashantdixit | last post by:
Hi, I have a worksheet name called "Import File" and there is a ActiveX combobox control "Start Time" in it. Name of ActiveX combobox control: ComboBoxStartTime This "Import File" sheet also...
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: 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
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
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
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
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...
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.