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

Macro issue...closing current form

xpun
39
hey all

ok i have a macro set to a button(main menu ) on a customer entry form.

Expand|Select|Wrap|Line Numbers
  1. close
  2. close
  3. openform
the problem is when the button(main menu) is clicked while the customer entry form is in edit mode (with the little pencil in the left hand corner) I get a “field cannot be null error…” which prevents the macro from running.

if i change the macro to this it works,

Expand|Select|Wrap|Line Numbers
  1. runcommand : undo
  2. close
  3. close
  4. openform

However it doesn’t work when the form is not in edit mode. An “undo is not available error…” message pops up.

is there any way to set some sort of conditional to fix this. Or suppress the error msg ???

any help is greatly appreciated
ACCESS 2003
Jul 26 '07 #1
4 3596
hey all

ok i have a macro set to a button(main menu ) on a customer entry form.

Expand|Select|Wrap|Line Numbers
  1. close
  2. close
  3. openform
the problem is when the button(main menu) is clicked while the customer entry form is in edit mode (with the little pencil in the left hand corner) I get a “field cannot be null error…” which prevents the macro from running.

if i change the macro to this it works,

Expand|Select|Wrap|Line Numbers
  1. runcommand : undo
  2. close
  3. close
  4. openform

However it doesn’t work when the form is not in edit mode. An “undo is not available error…” message pops up.

is there any way to set some sort of conditional to fix this. Or suppress the error msg ???

any help is greatly appreciated
ACCESS 2003
macro action>setwarnings, no
Jul 26 '07 #2
xpun
39
macro action>setwarnings, no
nope undo error pops up and the macro is stopped...
Jul 26 '07 #3
xpun
39
phew i finaly gave up on the macro and did it with vb..

I dont think the problem can be fixed in a macro.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command21_Click()
  2. If Me.Dirty = True Then
  3. RunCommand acCmdUndo
  4. DoCmd.Close acForm, "customer entry"
  5. DoCmd.OpenForm ("main")
  6. Else
  7. DoCmd.Close acForm, "customer entry"
  8. DoCmd.OpenForm ("main")
  9. End If
  10. End Sub
  11.  
Jul 26 '07 #4
missinglinq
3,532 Expert 2GB
Macros are very limited in what they can do. That's the reason that, with the exceptions of the Autoexec and AutoKeys macros, very few developers use them. They also have no provision for error handling, another huge handicap!

Linq ;0)>
Jul 26 '07 #5

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

Similar topics

10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
4
by: Mindy | last post by:
I have two questions here: (1) what is the difference of close form and close table? (2) How "Prompt" works I used close form macro in my database. I hope when a user close the form, he/she will...
4
by: ApexData | last post by:
Hello 1- What is the AutoExec Macro? Is it the same thing as AutoKeys Macro? 2- I'm looking to Control Keys equally on startup for my entire app. I understand that the AutoKeys Macro is the...
12
by: Laurent Deniau | last post by:
I was playing a bit with the preprocessor of gcc (4.1.1). The following macros expand to: #define A(...) __VA_ARGS__ #define B(x,...) __VA_ARGS__ A() -nothing, *no warning* A(x) -x ...
5
by: Bill | last post by:
This database has no forms. I am viewing an Access table in datasheet view. I'd like to execute a macro to execute a function (using "runcode"). In the function, I'll reading data from the record...
3
by: WU10 | last post by:
I have built a simple database to track the mechanical condition of offshore equipment. We established a system of ranking for issues that arise and used conditional formatting of the cell's...
1
seshu
by: seshu | last post by:
Hi Everybody I wrote to macros Show the genders (which will highlight all the He and She trems in document) dont Show the genders (which will dehighlight all the He and She...
2
by: Saloc | last post by:
Hi guys long time ive been in here hope you still can help, *grins* right all im looking for is a macro to add on to a list box ok what i have is a simple managment contact details system I...
1
by: todWulff | last post by:
Good day folks. Let me open with the statement that I am not a C++/C programmer. The environment that I am programming in is ARMbasic, an embedded BASIC targeted toward ARM-based...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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.