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

The command or action isnt available now. In sub form from main form

374 256MB
All,

I am tyring to delete a record within a sub form if th main form is closed and the property of a check box has not been set to checked.

Within the sub form on close event I have the following:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Close()
  2. If chkdidtheysaveit.Value = False Then
  3.  
  4. DoCmd.SetWarnings False
  5. DoCmd.RunCommand acCmdUndo
  6. DoCmd.SetWarnings True
  7.  
  8. End If
  9.  
  10. End Sub

To ensure that there is actually a record there to undo using the dirty event I have:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Dirty(Cancel As Integer)
  2. DoCmd.RunCommand acCmdSave
  3. End Sub
But I keep coming up with the error that the command or action Undo is not available now. Any ideas I have this same procedure working correctly within a main form but I cant when trying to undo something within a sub form.

Thanks,

Chris
Jul 14 '10 #1

✓ answered by munkee

Meh, Found it out all by myself in the end.

The recordset is unloaded near enough in the subforms close event:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Close()
  2. DoCmd.OpenQuery ("qryDeleteEmails")
  3. End Sub
Sorted.

3 1923
munkee
374 256MB
After doing some further reading I think im going to have to set up a delete query on my main forms close event.

I will set a checkbox in my subform table and programatically set this value to checked if someone clicks the submit button on the sub form. If they do not then it will remain unchecked.

When the main form unloads I will call the query which will use the ID number which links the main form to the subform and also the checkbox as criteria for deletions.

So if ID # 233 in main form and subform have any records with an unchecked value then delete them.


Does this sound feasable to everyone? I know it is very possible but is quite crude.
Jul 14 '10 #2
munkee
374 256MB
I have the simple delete query sorted now:

DELETE tblEmail.NCC_ID1, tblEmail.Sent
FROM tblEmail
WHERE (((tblEmail.Sent)=False));

However finding where I can place this is becoming the problem as I found I can not just simply call it within the on close of the main form since sub forms seem to be the last thing to deactivate?
Jul 14 '10 #3
munkee
374 256MB
Meh, Found it out all by myself in the end.

The recordset is unloaded near enough in the subforms close event:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Close()
  2. DoCmd.OpenQuery ("qryDeleteEmails")
  3. End Sub
Sorted.
Jul 14 '10 #4

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

Similar topics

10
by: iam247 | last post by:
Hi In my prototype asp page (with no javascript and no password validation, I have a registration form with the following action: <form name="form" method="post" action="RegDetails.asp"> ...
5
by: ChrisR | last post by:
Hi all Ive have a Main Form with Command Buttons down the Left hand side, that open various forms. Clicking on a button opens a Sub Form which is moved to take up 3/4s of the right of the main...
0
by: Olivier | last post by:
Hi, I have a (newbie)problem with a macro activated in a subform. That's the hierarchy in my form: Main form ----subform1 ----subform2 ----subform3 I have a macro that is called on...
0
by: Colin | last post by:
In access 2000 I need to filter records in a Subform by pushing a button on a command button located on the Main form. The Main form is blank. Its only purpose is to contain the subform which is...
1
by: NBruch | last post by:
Ok let me explain what im trying to do: i need a combo box which needs to be linked to a listbox (or combo box doesnt matter which really) then the listbox should bring up the record in a...
2
by: campos | last post by:
Hi all, I ran into a headache problem. I have a windows form with a progress bar on it. Then I new a thread to do calculation for a long time. I want the progress bar to show the calculation...
2
by: rlamber | last post by:
Hello, I have 2 subforms in a Main form, one links fine, the other doesn't. I am trying to link them both to a "tracking ID" on the main form. The Tracking ID is a text field that is a combination...
5
by: Thelma Roslyn Lubkin | last post by:
I am still having trouble trying to use a popup form to allow user to set filters for the main form. The main form is based on a single table. The popup contains 5 listboxes, so the user can...
2
by: ijyoung | last post by:
Am trying to customise automation in Access 2007/Outlook. Using MS template which works ok. However, I have the form set up as a subform an embedded in the main form Although the form works fine in...
11
by: OldBirdman | last post by:
I have a form with several bound textboxes. These are routinely updated by User. The table in RecordSource for this form currently has 8 fields not shown on this form, but which occasionally need...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
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,...
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
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
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
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...
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.