A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Controls in forms



 
 
Thread Tools Display Modes
  #1  
Old January 7th, 2010, 06:00 PM posted to microsoft.public.access.forms
Bill
external usenet poster
 
Posts: 1,009
Default Controls in forms

How do I add a control button that will open another form in "add" mode
rather than edit?
  #2  
Old January 7th, 2010, 06:05 PM posted to microsoft.public.access.forms
fredg
external usenet poster
 
Posts: 4,386
Default Controls in forms

On Thu, 7 Jan 2010 10:00:22 -0800, Bill wrote:

How do I add a control button that will open another form in "add" mode
rather than edit?


Set the Click event of the command button to:

DoCmd.OpenForm "FormName", , , , acFormAdd
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #3  
Old January 7th, 2010, 06:54 PM posted to microsoft.public.access.forms
Bill
external usenet poster
 
Posts: 1,009
Default Controls in forms

All it did was come up with a message that it couldn't find the object 'DoCmd'

"fredg" wrote:

On Thu, 7 Jan 2010 10:00:22 -0800, Bill wrote:

How do I add a control button that will open another form in "add" mode
rather than edit?


Set the Click event of the command button to:

DoCmd.OpenForm "FormName", , , , acFormAdd
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
.

  #4  
Old January 7th, 2010, 07:04 PM posted to microsoft.public.access.forms
fredg
external usenet poster
 
Posts: 4,386
Default Controls in forms

On Thu, 7 Jan 2010 10:54:01 -0800, Bill wrote:

All it did was come up with a message that it couldn't find the object 'DoCmd'

"fredg" wrote:

On Thu, 7 Jan 2010 10:00:22 -0800, Bill wrote:

How do I add a control button that will open another form in "add" mode
rather than edit?


Set the Click event of the command button to:

DoCmd.OpenForm "FormName", , , , acFormAdd
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
.


That offers us no help at all.
Did you change "FormName" to whatever your actual form name is?
Please copy and paste the full exact click event code into a reply
message.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #5  
Old January 7th, 2010, 09:20 PM posted to microsoft.public.access.forms
Bill
external usenet poster
 
Posts: 1,009
Default Controls in forms



Here is what I typed DoCmd.OpenForm "Tenants Move In". . . .acFormAdd
  #6  
Old January 7th, 2010, 09:26 PM posted to microsoft.public.access.forms
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Controls in forms

"Bill" wrote in message
...


Here is what I typed DoCmd.OpenForm "Tenants Move In". . . .acFormAdd



I see you have periods instead of commas. That would certainly be an error.

Did you type that directly into the button's On Click event property (that
would be an error), or did you create an event procedure and put this line
of code inside that event procedure (that would be the right way to do it)?

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

  #7  
Old January 7th, 2010, 09:37 PM posted to microsoft.public.access.forms
fredg
external usenet poster
 
Posts: 4,386
Default Controls in forms

On Thu, 7 Jan 2010 13:20:01 -0800, Bill wrote:

Here is what I typed DoCmd.OpenForm "Tenants Move In". . . .acFormAdd


That's not what I suggested.
You have used dots in place of commas.
The correct syntax is:
DoCmd.OpenForm "FormName", , , , acFormAdd

That's 4 commas after "FormName"
Look up, in VBA help, the OpenForm method for the correct syntax.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #8  
Old January 8th, 2010, 12:01 AM posted to microsoft.public.access.forms
Linq Adams via AccessMonster.com
external usenet poster
 
Posts: 1,474
Default Controls in forms

"All it did was come up with a message that it couldn't find the object
'DoCmd'"

Making the mistake with using periods instead of commas should have popped up
a "syntax error" message, but I don't think Access ever got that far!

Access stating it "couldn't find the object 'DoCmd'" suggests to me that the
OP probably has a missing reference that causing Access to error out.

The periods do, of course, also need to be replaced with commas.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com

  #9  
Old January 8th, 2010, 01:13 AM posted to microsoft.public.access.forms
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Controls in forms

"Linq Adams via AccessMonster.com" u28780@uwe wrote in message
news:a1c6ff9fda080@uwe...
"All it did was come up with a message that it couldn't find the object
'DoCmd'"

Making the mistake with using periods instead of commas should have popped
up
a "syntax error" message, but I don't think Access ever got that far!

Access stating it "couldn't find the object 'DoCmd'" suggests to me that
the
OP probably has a missing reference that causing Access to error out.



If Bill put the statement directly into the On Click property of the command
button, then clicking the button would give the error message "database
name can't find the macro 'DoCmd.'" My guess is that this is what has
happened.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

  #10  
Old January 8th, 2010, 07:12 PM posted to microsoft.public.access.forms
Linq Adams via AccessMonster.com
external usenet poster
 
Posts: 1,474
Default Controls in forms

Good point, Dirk! I hadn't even considered that! Be nice to get some feedback
from the OP.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:07 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.