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

Making a Macro or Module

I have code I'm using repeatedly in my program, and would like to convert it to
a module or macro, can anyone assist me? Thank you in adavance for all
assistance, it is greatly appreciated.

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "ffldName or Formname"
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms!frmKennel1!FormHolder = "Name of Form Currently On"

I would like to be able to create code to get the current open form name and
the form name to open on double click based on the field name being the same as
the form name and save it on a hidden form that is open all the time. Thank you
again.

Nov 13 '05 #1
2 1404
If that form is open all the time, then create a public sub of that form to
set the name, then call it from your form:

In AlwaysOpenForm:

Public Sub SetVisibleForm(fromName As String)
Me.txtVisibleForm = formName
End Sub
In the code for 'Open' buttons for your other forms:
DoCmd.Close acForm, Me.Name
AlwaysOpenForm.SetVisibleForm "NewForm"
DoCmd.OpenForm "NewForm"
Darryl Kerkeslager

"Lumpierbritches" <lu*************@aol.com> wrote:
I would like to be able to create code to get the current open form name and the form name to open on double click based on the field name being the same as the form name and save it on a hidden form that is open all the time. Thank you again.


Nov 13 '05 #2
Now I'm confused. "I have a field that currently holds the form that's
open" - I assume this field is the data for a textbox in a hidden form, or
at least a form that is always open - which I referred to as
"AlwaysOpenForm"

"I'm trying to create a module that will keep me from having to type that
code repeatedly." I'm not sure I understand what you mean now by 'that
code'. I thought you meant code that would close and open the form, while
keeping track of the current form.

"then I would also like to SetFocus on the field that was originally double
clicked from on that original form." - this is really throwing me. Usually
you click on a button to open a form, but hey, I see that you want to click
on the name of a form, stored in a textbox. But maybe not, since you then
want to move the focus back to the same field ...?

"When the form is open in edit mode, in code I would like to be able to get
the name of the form, so that I don't have to change the module on each
form?"

Perhaps if you used 'Form A', 'Form B', this would be more clear. Perhaps I
just don't get the real purpose here. What module are you talking about
changing? Please, if you explain it slowly for me, I know I can understand,
but at this point, I'm lost as to what it is you really want to accomplish.
Darryl Kerkeslager
(via EMail)
Darrel,

Thank you for your post, but I'm not sure I understand what you're saying. I have a field that currently holds the form that's open. I'm trying to
create a >module that will keep me from having to type that code repeatedly.
Dim frm as form
frm = fldFormsHolder

DoCmd.OpenForm frm

then I would also like to SetFocus on the field that was originally double clicked from on that original form.
When the form is open in edit mode, in code I would like to be able to get the name of the form, so that I don't have to change the module on each
form?
Michael "Darryl Kerkeslager" <Ke*********@comcast.net> wrote: If that form is open all the time, then create a public sub of that form to set the name, then call it from your form:

In AlwaysOpenForm:

Public Sub SetVisibleForm(fromName As String)
Me.txtVisibleForm = formName
End Sub
In the code for 'Open' buttons for your other forms:
DoCmd.Close acForm, Me.Name
AlwaysOpenForm.SetVisibleForm "NewForm"
DoCmd.OpenForm "NewForm"
Darryl Kerkeslager

Nov 13 '05 #3

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

Similar topics

25
by: Andrew Dalke | last post by:
Here's a proposed Q&A for the FAQ based on a couple recent threads. Appropriate comments appreciated X.Y: Why doesn't Python have macros like in Lisp or Scheme? Before answering that, a...
0
by: Donald 'Paddy' McCarthy | last post by:
So, for those that don't actively not-want a Python macro facility. If we are to have it what should it do? 1) Macro definitions should allow Doc strings. 2) There should be a separate statement...
3
by: Caleb Hattingh | last post by:
Hi Here is a script I want to be able to write (explanation appears after): *** start of script *** import MyCustomMacroLib # This does the magic I would like help for. # This is not...
2
by: Jorge Gallardo | last post by:
Hola a todos. Me gustaria saber si se puede utilizar lo del asunto desde una accion de macro... Si no es asi, como podria convertirlo a modulo para llamarlo desde la macro. Necesito que el...
0
by: jpodesta | last post by:
Hello- I am fairly new to MS Access and would like to use some macros in .xls in an Access Module. I have tried to do this on my own but failed to make it work. I have included the xls macros...
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...
2
by: ozzie8 | last post by:
I am try to get a macro to call a module, which in turn calls a VBA form but am having no luck at all. Can anyone help me out? I am trying to use the OpenModule action in the Macro. I have set the...
3
MMcCarthy
by: MMcCarthy | last post by:
Although some users find Macros simple and easy to use, there are some major limitations to using them. Although you can use macros to perform tasks, there is limited control on when and how those...
1
MitchR
by: MitchR | last post by:
Good Morning Folks; I have a question that is pretty far fetched but here goes nothing... I am looking to find a way to insert a macro into an Excel command button located in an Access VBA...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
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...
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,...

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.