Quick question that I can't find a solution to:
I have an ADP application that uses SQL Server 2000 backend, along with stored procedures that populate my forms. I do not want to use subforms for various reasons, so my data is loaded into a single form (record source is a stored procedure, and the form's InputParameters are changed depending on the data to load, pretty standard).
However, if no records are returned by the procedure, all the controls in the Detail section of the form are hidden. This wasn't a problem when I used subforms because I had navigation controls on the parent, and those weren't impacted.
However, now all my navigation controls are in the detail section of the form, so if records are not returned all the controls are hidden and I can't use any of the controls I need to modify the parameters to return a valid record set.
Anybody come across this before and have a fix? Such as making the form display the controls with Null data in the event no records are returned from the stored procedure?
12 3151
Usually you see this when no records are returned and AllowAdditions Property for the form is set to No. Is that the case here? If so, can you set AllowAdditions to Yes?
Welcome to TheScripts!
Linq ;0)>
AllowAdditions is set to NO currently.
I do not want to allow additions to the recordset that i'm displaying though, which is why it's set to NO.
I fixed it!
I added the following to the Form's BeforeInsert property: - Private Sub Form_BeforeInsert(Cancel As Integer)
-
Cancel = True
-
End Sub
Now the form loads with blank controls that can't be edited, then can be edited once a valid recordset is loaded.
Take it back, I thought I fixed it.
Suddenly not working again :(
So, when you do have a valid recordset loaded, you never need to enter new records thru this form?
Linq ;0)>
Correct, this record set is for viewing and updates only.
No deletes or additions on this form.
Not good enough unfortunately, it's still not working consistently :/
I don't have time to thouroughly test this and, in truth, don't know all the ins and outs of what you're doing, but I think this will work for you. Leave AllowAdditions set to Yes. Now use this code: - Private Sub Form_Dirty(Cancel As Integer)
-
If RecordsetClone.RecordCount < 1 Then
-
MsgBox "You must pick new parameters for record retrieval"
-
Cancel = True
-
Else
-
Me.AllowAdditions = False
-
End If
-
End Sub
Even with an empty recordset, the controls will remain visible, but if a user tries to enter a new record, they'll get the message telling them they need to pick new criteria for displaying records. You can, of course, change the message to suit your needs. When a valid recordset exists, the AllowAdditions will be set to False if the user tries to enter a new record.
Linq ;0)> Sign in to post your reply or Sign up for a free account.
Similar topics |
by: (Pete Cresswell) |
last post by:
..DefaultView = Continuous Forms
..RecordSource = a query.
While the form & subform are open, I can open up the .RecordSource query and see
five records.
If I insert a record, then re-open the query, there'll be four records - but the
subform is only showing the one I just added.
|
by: MLH |
last post by:
I have created two forms: frmBrowseNegsMainform and
frmBrowseNegsSubform. I put a subform control on the
first of these. The SourceObject property for the subform
control is, of course, frmBrowseNegsSubform.
I would like to perform an ascending or descending sort
on any of the 7 columns shown in datasheet view in the
subform control. I've been unsuccessful.
Is there something tricky about sorting in subform controls?
|
by: MS |
last post by:
Access 97 here.
I want a simple way to "lock" certain records on a form. Some records remain
"live" until all data is available which happens over time. When all the
fields are complete, I want the record to be able to be "locked", or
intentionally unlocked.
I thought of having a check box called "chkedit" that can be clicked when
the data entry for the record is complete. I have the following code in the
OnCurrent event for the...
|
by: MLH |
last post by:
I have a combo box control on a form and a text
box beside it in which I would like to display the
number of listings in the combo-box. The combo
box lists more or fewer rows depending on the
user's selection and application of various filtering
mechanisms on the form. So, I cannot use DAO to
count the records returned by the QBF SQL.
Is there another way I can determine the number
of records returned by the dropdown box?
|
by: mursyidatun ismail |
last post by:
Dear all,
database use: Ms Access.
platform: .Net
i'm trying to update a record/records in a table called t_doctors by
clicking da edit link provided in the database.
when i ran through da browsers and click update it gave me this error:
Specified argument was out of the range of valid values. Parameter name:
| |
by: Wayne Brantley |
last post by:
VS2005 RTM
Create a web user control to use as a base class for other web user
controls.
Now, create a new web user control, change the class it inherits from to
your base class and compile.
(You must have a <% Register %> so it will see it)
You will get TWO warnings per class like:
|
by: Antonio |
last post by:
Can someone tell me why the following procedure updates ALL the records in
the database with the field being updated for one record?
private void updateRow(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
SqlConnection conn = new SqlConnection
(ConfigurationSettings.AppSettings);
SqlCommand updCommand = new SqlCommand();
|
by: 60325 |
last post by:
This is the page where I collect the data in drop-down boxes with
values of 1-10 and send it to a submitted page to do calculations.
Example:
Employee1 TeamScore(1-10)
Employee2 TeamScore(1-10)
Employee3 TeamScore(1-10)
Employee4 TeamScore(1-10)
Then I submit this page with all the values in TeamScore for every
employee and I want to
perform a calculation based on the values in the drop-down and a
|
by: Martijn Mulder |
last post by:
When I place both a MenuStrip and a Button on my Form, the button covers
part of the menu. I hate to mess around with the Size and Location
properties of Controls, so normally I lay out my controls with instances
of FlowLayoutPanel and TableLayoutPanel. But in this case I cannot find
a reasonable solution.
What is a recommended way to avoid this problem?
using System.Windows.Forms;
class Examplet
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |