Hello Everyone
I have a main form (frmNewOrder) and a sub form (SubOrderBenefi ciary).
On the main form I have a button which sends the Subform
(SubOrderBenefi ciary) to a newrecord. Everything works fine expect that
when I press the button, the controls on the subform display an #Error
for a fraction of a second when changing from the current record on the
subform to the new record and theneverything works fine.
Does anyone knows how can I prevent this as it does not look
professional?
The code Im using is as follows:
Private Sub cmdNewBene_Clic k()
On Error GoTo Err_cmdNewBene_ Click
Dim cn As ADODB.Connectio n
Dim rs As ADODB.Recordset
Set cn = CurrentProject. AccessConnectio n
Set rs = New ADODB.Recordset
Set SubBen = Me.SubOrderBene ficiary.Form
With rs
Set .ActiveConnecti on = cn
.Source = "SELECT * FROM tblBeneficiary WHERE BeneficiaryID =
''"
.LockType = adLockOptimisti c
.CursorType = adOpenKeyset
.Open
End With
Set SubBen.Recordse t = rs
Set rs = Nothing
Set cn = Nothing
Me.SubOrderBene ficiary.SetFocu s
Exit_cmdNewBene _Click:
Exit Sub
Err_cmdNewBene_ Click:
MsgBox "Your request could not be processed. Err 14 - " &
Err.Description & Err.Number, vbCritical, "Error"
Resume Exit_cmdNewBene _Click
End Sub
Any comments and possible solution would help me a lot.
Thanks in advanced.
GAVO. 20 2271
GAVO-UK wrote: Hello Everyone
I have a main form (frmNewOrder) and a sub form (SubOrderBenefi ciary). On the main form I have a button which sends the Subform (SubOrderBenefi ciary) to a newrecord. Everything works fine expect that when I press the button, the controls on the subform display an #Error for a fraction of a second when changing from the current record on the subform to the new record and theneverything works fine.
Does anyone knows how can I prevent this as it does not look professional?
The code Im using is as follows:
Private Sub cmdNewBene_Clic k() On Error GoTo Err_cmdNewBene_ Click
Dim cn As ADODB.Connectio n Dim rs As ADODB.Recordset
Set cn = CurrentProject. AccessConnectio n Set rs = New ADODB.Recordset Set SubBen = Me.SubOrderBene ficiary.Form
With rs Set .ActiveConnecti on = cn .Source = "SELECT * FROM tblBeneficiary WHERE BeneficiaryID = ''" .LockType = adLockOptimisti c .CursorType = adOpenKeyset .Open End With
Set SubBen.Recordse t = rs Set rs = Nothing Set cn = Nothing Me.SubOrderBene ficiary.SetFocu s
Exit_cmdNewBene _Click: Exit Sub
Err_cmdNewBene_ Click: MsgBox "Your request could not be processed. Err 14 - " & Err.Description & Err.Number, vbCritical, "Error" Resume Exit_cmdNewBene _Click End Sub
Any comments and possible solution would help me a lot.
Thanks in advanced. GAVO.
Can you do something like this? Create a button in the main form with
code similar to
Me.SubFormName. SetFocus
DoCmd.GoToRecor d acActiveDataObj ect, , acNewRec
Your code does send the subform to a new record and does not display
the #Error, but it does not allow me to EDIT the new record.
Any other possible solutions?
Thanks
GAVO.
GAVO-UK wrote: Your code does send the subform to a new record and does not display the #Error, but it does not allow me to EDIT the new record.
Any other possible solutions?
Thanks GAVO.
Do you have AllowEdits set to true? Is your recordsource for the form
updateable?
My Form is unbound and yes i can edit records?? what about my code,
would you think of anything that I could do to prevent the #Error?
Thanks
GAVO-UK wrote: My Form is unbound and yes i can edit records?? what about my code, would you think of anything that I could do to prevent the #Error?
Thanks
Haven't a clue. Maybe set Painting or Repainting to False until the
code executes. Maybe Application.Ech o = False too.
GAVO-UK wrote: Any comments and possible solution would help me a lot.
I'm glad you said that. My answer for almost all record selection,
creation and navigation problems on forms and subforms is this:
Access 2003 costs $130 CAD (Staples Business Depot 2005-11-30). It does
a few things superbly. One of these is to handle record selection,
creation and navigation on forms and subforms. Remove your code and
buttons and let Access do its job. That's what you paid the $130 CAD or
its equivalent for.
I've programmed Database User Interfaces for more than twenty years;
that's what I do.
Has anyone actually bought anything from you on this news group? I
really doubt it.
Still, any comments about my problem, highly appreciated.
GAVO.
"GAVO-UK" <an****@peoplee x.com> wrote Has anyone actually bought anything from you on this news group? I really doubt it.
I suggest you re-read Lyle's post. You obviously missed his point.
--
Darryl Kerkeslager This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Hari Om |
last post by:
Here are the details of my error log files:
I execute the command and get following message at console:
----------------------------------------------------------------------
../sqlldr scott/tiger@common control=/full_path/test.ctl
log=/full_path/adhoc/test.log
SQL*Loader: Release 9.2.0.1.0 - Production on Tue Sep 2 10:49:27 2003
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
|
by: Steve |
last post by:
I have a form with about 25 fields. In the BeforeUpdate event of the form, I
have code that sets the default value of each field to its current value. For a
new record, I can put the focus in any field to start. If I edit that field and
then click on the new record button in the navigation buttons, the form goes to
a new record and each field has the default value of the previous record. If I
put the focus in any field to start, edit that...
|
by: RC |
last post by:
I am getting the following error message.
"Write Conflict this record has been changed by another user since you
started edting it. If you save the record, you will overwrite the
changes...."
I have an Access 2002 database running on a single PC, the front and
backend have not been separated yet. I have a form where I use a text
box to jump from record to record. The form has about 12 bound text
boxes on it. The table that is the...
|
by: hebandgene |
last post by:
When I delete a record in a subform I get the warning that I'm about to
delete a record, followed by an error "No current record." When I
click OK obviously the record is deleted and it goes to the first
record (as I've coded it to do) or it shows me a blank record if the
deleted record was the only one.
So, what I'd like to do is bypass that 'No current record' altogether
to avoid user confusion. Is there any way to code it out...
|
by: MS |
last post by:
Access 97
I want to requery the data being displayed on a form, then I want to return
to the record I was in.
Why doesn't this code work?
Private Sub CmdRefsh_Click()
| |
by: Zlatko Matiæ |
last post by:
There is a form (single form) and a combobox. I want that current record of
the form is adjusted according to selected value in the combobox. Cuurrent
record should be the same as the value in the combobox.
What is the solution?
Thank you in advance.
|
by: Scott269 |
last post by:
So I've got an old MS Works database I imported into Access. I needed
a primary key so I created a record number field that was just the
record number I manually inserted when I entered it in the database so
I could sort the records by the date at which they were entered.
Well now I've deleted some of those records so its of course causing
gaps in the records. The record number in Access no longer matches my
record number that I...
|
by: Susan Bricker |
last post by:
I have a command button on a form that is supposed to Delete the record
being displayed. The record is displayed one to a form. The form is
not a Pop-Up nor is it Modal. Tracing the btnDelete event routine shows
that AllowDeletions is TRUE.
When the Delete button is clicked (without TRACE ON), I get a 'beep',
the recordselector (vertical bar on left of form) gets dark in color,
but the record is not deleted. Also, there is no error...
|
by: Tom |
last post by:
Hi
I have an aspx page which has javascript to configure xmldata. I added breakpoint to the button method. When I click submit button, it did not go to those breakpoint and show the following error
System.Web.HttpRequestValidationException (0x80004005)
Detect the potential danger of Request.Form value from client side (idHidxml="<recordset><record><...")
System.Web.HttpRequest.ValidateString(String s, String valueName, String...
|
by: prakashwadhwani |
last post by:
The Delete Event/Proc & "Save_Fields_In_Form_Header" Event/Proc in
my form were working perfectly.
However, after I added a call to the "Save_Fields_In_Form_Header"
Event/Proc in the "Current" Event of my form, and I now try to Delete
a record, I get ... Run-Time Error 3218 - Could not Update; Currently
Locked. My Access application then effectively freezes forcing me to
shut Access down & re-start.
The record DOES get deleted...
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |