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

Replace one section of code instead of replacing the whole form

Instead of sending an entire form to a client that includes code changes,
I'm trying to update just one section of code.

If I know the object, function name & property, is there a way to search
that function, and replace the current function's info with new function
info?

Example of what I need...
(1) Open the "frmClients" form in design view. (I can do already).
(2) Find the code behind the OnClick property of btnPrintHistory.
(3) Replace the OnClick property code of btnPrintHistory with a different
piece of code, stored in c:\NewCode.txt.
(4) Save & close the form. (I can do already)

History: I've created other functions to replace the entire form (sending
the whole form in an "update database" file, automating the renaming of
the original form then importing the new form). But, I've taught some
clients how to add buttons and fields. If I replaced the entire form,
their own changes are gone, so I'd like to try to figure out a way to
change the code of one button as described above.

Thx in advance!

Nov 13 '05 #1
7 1570
Access2003Guru wrote:
Instead of sending an entire form to a client that includes code changes,
I'm trying to update just one section of code.

If I know the object, function name & property, is there a way to search
that function, and replace the current function's info with new function
info?

Example of what I need...
(1) Open the "frmClients" form in design view. (I can do already).
You must open the code module here before you can do (2) See
docmd.openmodule. (As of A97, that is)
(2) Find the code behind the OnClick property of btnPrintHistory.


dim M as module
docmd.openmodule "form_frmClients"
set m=modules("Form_frmClients")
now, check what you can do with M. Intellisense should point you out; be
sure to read all documentation you have.

If you wind up having more questions now than answers, that's good for
now. I hope Help is available to you; otherwise I'd be happy to chunk in
my results (with A97, again)

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #2
Sorry that this doesn't really answer your question directly, but do you
split out your databases? That way all the important data is in one mdb and
the code, queries and macros are in another mdb that you update from time to
time.

Scott

"Access2003Guru" <ac************@hotmail.com> wrote in message
news:ed******************************@localhost.ta lkaboutdatabases.com...
Instead of sending an entire form to a client that includes code changes,
I'm trying to update just one section of code.

If I know the object, function name & property, is there a way to search
that function, and replace the current function's info with new function
info?

Example of what I need...
(1) Open the "frmClients" form in design view. (I can do already).
(2) Find the code behind the OnClick property of btnPrintHistory.
(3) Replace the OnClick property code of btnPrintHistory with a different
piece of code, stored in c:\NewCode.txt.
(4) Save & close the form. (I can do already)

History: I've created other functions to replace the entire form (sending
the whole form in an "update database" file, automating the renaming of
the original form then importing the new form). But, I've taught some
clients how to add buttons and fields. If I replaced the entire form,
their own changes are gone, so I'd like to try to figure out a way to
change the code of one button as described above.

Thx in advance!

Nov 13 '05 #3
This KB article on how to use code to write code might be helpful:

http://support.microsoft.com/default...b;en-us;208793

"Access2003Guru" <ac************@hotmail.com> wrote in message
news:ed******************************@localhost.ta lkaboutdatabases.com...
Instead of sending an entire form to a client that includes code changes,
I'm trying to update just one section of code.

If I know the object, function name & property, is there a way to search
that function, and replace the current function's info with new function
info?

Example of what I need...
(1) Open the "frmClients" form in design view. (I can do already).
(2) Find the code behind the OnClick property of btnPrintHistory.
(3) Replace the OnClick property code of btnPrintHistory with a different
piece of code, stored in c:\NewCode.txt.
(4) Save & close the form. (I can do already)

History: I've created other functions to replace the entire form (sending
the whole form in an "update database" file, automating the renaming of
the original form then importing the new form). But, I've taught some
clients how to add buttons and fields. If I replaced the entire form,
their own changes are gone, so I'd like to try to figure out a way to
change the code of one button as described above.

Thx in advance!

Nov 13 '05 #4
Cool - I'll give that a shot.

Nov 13 '05 #5
Yes - the databases are already split. I'm just needing to modify code of
one button property in the front-end db and send it to the person with the
live database without affecting any other part of that form.

Nov 13 '05 #6
I'll take a look at that. At first glance, it looks like it is just
modifying a module object and not others (i.e. a form), but it's
definitely a step in the right direction. Thx!

Nov 13 '05 #7
I've only used this for standard modules, but I believe you can use it for a
form's module by referring to the module this way:

Forms![MyForm].Module

and then using the module's methods and properties as the article describes.

"Access2003Guru" <ac************@hotmail.com> wrote in message
news:7b******************************@localhost.ta lkaboutdatabases.com...
I'll take a look at that. At first glance, it looks like it is just
modifying a module object and not others (i.e. a form), but it's
definitely a step in the right direction. Thx!

Nov 13 '05 #8

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

Similar topics

12
by: Brian | last post by:
I want to use regxp to check that a form input contains at least 1 non-space charcter. I'd like to only run this if the browser supports it. For DOM stuff, I'd use if (documentGetElementById) {}...
4
by: Locusta | last post by:
Hello, I have been struggeling for replacing a string in a string. The snippet from the program below replaces the <, & and > with the XML equivalent values. In the program, I allocate space...
3
by: Andy Sutorius | last post by:
Hi, I read the thread (2/16/05) regarding a replace function in C# however it didn't answer my question. I have a string which is building an insert sql statement and I would like to replace...
5
by: djc | last post by:
I need to prepare a large text database field to display in an asp.net repeater control. Currently I am replacing all chr(13)'s with a "<br/>" and it works fine. However, now I also want to be able...
23
by: digitalorganics | last post by:
How can an object replace itself using its own method? See the following code: class Mixin: def mixin(object, *classes): NewClass = type('Mixin', (object.__class__,) + classes, {}) newobj =...
5
by: V S Rawat | last post by:
I was trying to use back-to-back replace functions to convert a url: str1 = str.replace("%2F","/").replace("%3F","?").replace("%3D","=").replace("%2 6","&"); It didn't replace all 4 types of...
4
by: SirCodesALot | last post by:
Hi All, I am trying to dynamically replace a table in the dom, anyone have an idea on how to do this. here is some sample suedo code of what I want to do. var tableHTML = "<table...
6
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello, I have some XML that is returned to my application from another vendor that I cannot change before it gets to me. I can only alter it after it gets to my application. That being said, I...
5
by: shapper | last post by:
Hello, I have a text as follows: "My email is something@something.xyz and I posted this @ 2 am" I need to replace the @ by (AT) bu only the ones that are in email addresses. All other @...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.