473,387 Members | 1,664 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,387 software developers and data experts.

Unload/close a popup form after updating

I am new in access so any help would be very much appreciate.
I have a popup form, frmAddComposerWork, which is open with Data Entry set to Yes, where there are 2 text boxes: One for the composer name and the other for the Work title.
After filling the last text box, when I hit ENTER (to update the table behind with the new record) I want to close the form as well. I have tried several events on which I added the following VBA instruction:

DoCmd.Close acForm, Me.frmAddComposerWork

However, the form stays open and is prone to receive a new record (which I do not want at all).

I am sure that this is very simple, but I have being scratch my head all the week and I haven't find the answer. Can someone help? Thank you
Aug 10 '18 #1

✓ answered by zmbd

This is not "Strange Behavior" by any means because the syntax is incorrect:

DoCmd.Close ObjectType:=acForm,ObjectName:=Me.Name Save:=acSaveNo
You have to pass the name of the form as a string or by referencing the name property of the form which returns a string with the form's name.

IMHO: Get ditch the Macro - USE VBA

Sending you a copy of my Reference Boilerplate in your Bytes.com InBox

6 2465
DJRhino1175
221 128KB
You could always add a command button to your pop up form that will close the form once you click on it. Using VBA or even the command button wizard.
Aug 10 '18 #2
DJRhino1175, thank you for your suggestion.
Making a button with the wizard to close the form then it works perfectly. But if I do a button and trigger the Docmd Close with the click event it does nothing! It is a very strange behavior.
Aug 10 '18 #3
zmbd
5,501 Expert Mod 4TB
This is not "Strange Behavior" by any means because the syntax is incorrect:

DoCmd.Close ObjectType:=acForm,ObjectName:=Me.Name Save:=acSaveNo
You have to pass the name of the form as a string or by referencing the name property of the form which returns a string with the form's name.

IMHO: Get ditch the Macro - USE VBA

Sending you a copy of my Reference Boilerplate in your Bytes.com InBox
Aug 10 '18 #4
Thank you @zmbd. It solved the issue, and now I can leave the form immediately after updating the last text box, which was the original aim.
Aug 11 '18 #5
zmbd
5,501 Expert Mod 4TB
a side conversation about Named vs Un-named arguments in code was moved to its own thread here: https://bytes.com/topic/access/answe...arguments-code
Aug 11 '18 #6
zmbd
5,501 Expert Mod 4TB
GreenLion

!Two-Thumbs-Up!
Aug 11 '18 #7

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

Similar topics

4
by: Steve | last post by:
Does anyone know of a way to open a messagebox over a popup form opened in acDialog mode? Thanks for any ideas! Steve
4
by: Ellen Manning | last post by:
Using A2K. I have a form that allows the user to print one or more reports. The user checks which report they want printed then they click on a button to start printing. A popup form displays...
1
by: Richard Coutts | last post by:
I have a Continuous Form where each record has a button that activates another form that simplifies entering values into the record. The activated form has the equivalent of a "Done" button. I'd...
4
by: GrantS | last post by:
I am having a problem closing a popup window opened modally. When I try to close the window (when the user hits save button and the data has been processed), the Popup window opens as a full screen...
4
by: SteveS | last post by:
Hello. This is a strange problem which does not make sense to me. I open a popup page with the following javascript code: function OpenDenyWindow(changeId) {...
18
by: Colin McGuire | last post by:
Hi - this was posted last weekend and unfortunately not resolved. The solutions that were posted almost worked but after another 5 days of working on the code everynight, I am not further ahead....
13
by: Deano | last post by:
Apparently you can only do this with one value i.e Call MyAssetLocationZoom(Me!txtLocation, "Amend data") This runs; Public Sub MyAssetLocationZoom(ctl As Control, formName As String) On...
1
by: Fred | last post by:
I have the following code in a button on my modal popup form After the user enters the information, they click on a button. I want the form to close after processing the information. At the...
4
by: Macbane | last post by:
Hi, I have a 'main' form called frmIssues which has a subform control (named linkIssuesDrug) containing the subform sfrmLink_Issues_Drugs. A control button on the main form opens a pop-up form...
2
by: Del | last post by:
I have a popup form that consist of a single field called EnteredBy and a Subform that has three fields. The popup form also has a button in the Form Footer called close. In the On Click event I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.