473,503 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to delete from cloned recordset?

For some reason this is eluding me...

I have a subform datasheet that contains appointments imported form Outlook.
If the appointment is associated with an Entity in the database, it will
have a valid ID; if the appointment is not associated with an Entity (if the
appointment is a holiday, for example) then the ID will not be valid, or
will be 0. Nevertheless, the Datasheet should display all appointments
whether the ID is valid or not.

The below routine is supposed to go to the next valid Entity appointment,
and skip over invalid IDs (for example, if the next Entity appointment is on
Dec. 28th, I don't want to go to the 25th). So I'm trying to purge the rst
of any IDs that are not valid and thus force rst.FindFirst to find the first
Entity appointment occuring after the current date.

I don't want to remove the non-Entity appointments from the Datasheet - I
just want to ignore them in this routine so I can use a Bookmark to go to
the next valid Entity appointment. But, AFAIK, I can only use Bookmarks
with a cloned Recordset. When I delete the non-Entity appointments from the
cloned rst, the records no longer appear in the Datasheet - they are, of
course, deleted.

How can I keep the non-Entity appointments in the Datasheet and still use a
Bookmark to go to the next valid Entity appointment?

Thanks in advance.

Public Sub GoToNext()
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
Do Until rst.EOF
If Nz(DLookup("Entity_ID", "tblEntity", "Entity_ID = " &
rst!Entity_ID), 0) Then 'Eid is valid - do nothing
Else 'remove from rst
rst.Delete
End If
rst.MoveNext
Loop
rst.MoveFirst
rst.FindFirst "[ApptDate] >= Date()"
If rst.NoMatch Then GoTo Exit_Here
Me.Form.Bookmark = rst.Bookmark
Exit_Here:
rst.Close
Set rst = Nothing
End Sub
Nov 13 '05 #1
0 1507

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1950
by: Mike | last post by:
I'm having a problem with the grid not getting refreshed after deleting a record. Even though the record is deleted from the table. I have the following code in a Delete button event: sql =...
8
4033
by: Steve | last post by:
I have several pairs of synchronized subforms in an application. I have a Delete button for each pair that uses the following code or similar to delete a record in the second subform: ...
5
25442
by: tony010409020622 | last post by:
I just spent 4 months taking a dotnet class where i learned very little. One of the things I did not learn is this: What are the dotnet equivilents of commands such as: Adodc1.Recordset.AddNew...
1
2320
by: SteveBark | last post by:
Hello all I am currently trying to develop a script that will take a value from an Excel spreadsheet cell and use that to run a query against an Access table to delete all rows that match the...
3
6120
by: igendreau | last post by:
I'm trying to clean up a database of mine, and I need to convert some old DAO code over to ADO. When I was using DAO, I had no problem running this script and deleting the record using rs.Delete. ...
4
8658
by: felicia | last post by:
Hi All, Below is my code to delete records: adodcAllEntries.Recordset.MoveFirst Do While (adodcAllEntries.Recordset.EOF = False) If adodcAllEntries.Recordset.Fields(0) = selected_id Then...
5
14296
kcdoell
by: kcdoell | last post by:
Hello: I am trying to write a code that will delete all records found in my DAO recordset Below is the code I have so far: 'Procdure to give the user the ability to delete all records 'for a...
2
15091
kcdoell
by: kcdoell | last post by:
Hello I have a code where I want to delete the records that are found in my DAO recordset. I took a stab at this for the first time and got it to work but it is only delete one record at a time. If...
0
7074
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
7273
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,...
0
7322
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
7451
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...
1
5000
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...
0
3161
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...
0
1501
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 ...
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
374
bsmnconsultancy
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...

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.