Hello,
I have a form where I only allow new records to be added. I enable
this by setting the form property "Data Entry" to Yes.
I want to access other records in the same table- to autofill the new
record with a user select previous record.
Dim rs As Recordset
Set rs = Me.RecordsetClo ne
rs.MoveLast
MsgBox rs.RecordCount 'returns error when Data Entry =
Yes
When only allowing new records, this code returns "Run-time error
'3201', No current record." It works fine if the form isn't only
allowing new records.
Thank you in advance for reading this and providing assistance. 2 2882
You cannot use RecordsetClone for records that are not in the form. As the
name suggests, the clone set contains only the same records as in the form.
You will need to use another approach to retrieving other data from the
table. DLookup() might be the simplest: http://allenbrowne.com/casu-07.html
OpenRecordset() will be more efficient if you are retrieving multiple
values, but requires some understanding of how to code it. Here's a basic
example: http://allenbrowne.com/func-DAO.html...cordsetExample
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
<Ce****@gmail.c omwrote in message
news:11******** **************@ l77g2000hsb.goo glegroups.com.. .
Hello,
I have a form where I only allow new records to be added. I enable
this by setting the form property "Data Entry" to Yes.
I want to access other records in the same table- to autofill the new
record with a user select previous record.
Dim rs As Recordset
Set rs = Me.RecordsetClo ne
rs.MoveLast
MsgBox rs.RecordCount 'returns error when Data Entry =
Yes
When only allowing new records, this code returns "Run-time error
'3201', No current record." It works fine if the form isn't only
allowing new records.
Thank you in advance for reading this and providing assistance.
Thank you Allen. I have successfully used OpenRecordset() and it works
wonderfully.
Thank you.
On Mar 15, 11:51 pm, "Allen Browne" <AllenBro...@Se eSig.Invalid>
wrote:
You cannot use RecordsetClone for records that are not in the form. As the
name suggests, the clone set contains only the same records as in the form.
You will need to use another approach to retrieving other data from the
table. DLookup() might be the simplest: http://allenbrowne.com/casu-07.html
OpenRecordset() will be more efficient if you are retrieving multiple
values, but requires some understanding of how to code it. Here's a basic
example: http://allenbrowne.com/func-DAO.html...cordsetExample This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Skully Matjas |
last post by:
I am using the following code (created by the wizard) to
allow to bring my form to a particular entery. But when I
edit the entery (ex: put new information into a blank
cell), it puts that record onto the bottom of the list
(even though it keeps its record number).
Also, There are certin names that i click on the list, and
it will not bring it up, rather it brings to the first
record (no matter how many times i try going to that...
|
by: Danny J. Lesandrini |
last post by:
The following code works with a standard MDB to navigate
to a particluar record (with a DAO recordset, of course)
but it's giving me problems in an ADP I'm working on.
Dim rs As ADODB.Recordset
Set rs = Me.RecordsetClone
rs.Find "=" & lngContractID
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
I must site the Heisenberb Uncertainty Principal here, as it
|
by: Christine |
last post by:
I am trying to create a data entry form for my database that will
enable a user to add a new record or alter an existing record in the
table all on one form. So far, the form is set up to display the
records of the table in text boxes at the bottom, and I can scroll
thru the records, and a button("Add A New Patient") will allow the
user to go to the end of the table and enter data. The other button
("Find A Patient") has been more...
|
by: James Fortune |
last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't
understand why people who know how to write code to completely replace
a front end do not write something that will automate the code that
implements managing unbound controls on forms given the superior
performance of unbound controls in a client/server environment. I can
easily understand a newbie using bound controls or someone with a
tight deadline. I guess I need...
|
by: John T Ingato |
last post by:
I have a form that shows all the contact data from a query of customers.
Each field is bound to a field in the query. If I try to change the
"StoreNumber" or any field as a matter of fact, i get the "ding".
Not sure why I can't change any data here.
My goal was to NOT allow anyone to change this data except the
"StoreNumber", which wouldn't change the data in the recordset, but search
the recordset for the match.
| |
by: RichardP |
last post by:
Hi there everyone - I'm new to this forum.
I am having an issue when running an application from an instance of Access
which has been started through automation (early or late bound, makes no
difference).
No warning / confirmation messages are issued (eg. when running action
queries, deleting records from a datasheet, deleting database objects such as
tables).
|
by: BillE |
last post by:
What is the best way to add data using a DataGridView in a multi-tier
application (data entry is handled in a data access layer using stored
procedures)?
Thanks
Bill
|
by: bosmatthews |
last post by:
I have a main form with a subform and a second subform nested to the first subform. The data entry property for all three forms (main, subform and sub-subform) is set to "yes" because I am intending this form to be used for data entry only. The main form has a combo box from which the user can select a lake. The first subform allows the user to enter survey data for the lake. The sub-subform allows the user to enter additional (plant...
|
by: Bobby |
last post by:
Hi
I have a form which I need to call from several different parts of my
application. Depending on where it is called from, the Data source
will change. The only way I know of to open a form from VBA is to use
DoCmd.OpenForm. However, is there any way I can pass the data source
as well? I've tried using the OpenArgs parameter, which partially
works, but I have code on form.current which does a recordsetclone.
When it gets to this I get a...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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: 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: 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...
| |