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

Help writing a module

I am experienced with databases and sql, but lacking in vba skills. I
need to write a module to delete all records from a specified table and
then append records to this table from another table. I will also need
to connect to a linked table using an ID and password. Thanks in
advance.

Nov 13 '05 #1
4 2278
I'm bad at that to, what I do is create the macro, then save it.

After I save the macro I right click on it and save as a module. Then
I go to the modules tab and open that module, it will have the same
name as the macro. I copy the code and paste it into the event I want
to use it with.

After that I delete the macro and the module because I don't need it
anymore. I almost never use macro's.

Hope this helps I'm starting to learn a little from that.

Nov 13 '05 #2
Jim,
Some basics.
1. Standard VBA modules (not class modules) are easier to work with
initially but if you like working with object oriented code like Pascal
(which VBA resembles) or C++ then class modules are a better way to go.
2. Debugging is much easier if you habitually write functions that return a
value indicating the outcome of the function--it worked would evaluate to
True, it errored out for some reason would return the numeric error code.
3. Both the DAO and ADO libraries include objects which will execute your
SQL. DAO has QueryDefs and the dbEngine.execute method. ADO has its
Command object.
4. The Connection object of ADO has a ConnectionString property which
includes a login name and password attribute. A little simple string
concantenation will let you insert your login name and password. The
weakness here is that the account name and password can be stored in the VBA
module as clear text and that weakens database security. This can be
mediated if you ask the person running the routine to provide their login at
run time.
5. Your algorhythm is: a. Execute an SQL DELETE statement to dump the old
records, Execute an INSERT statement which pulls the new data, but you
probably knew that.
6. The desktop version of SQL Server included in Office since 2000 does
support scripted SQL and may be a better option if you are used to better
database engines which support more of the ANSI SQL standard.

<ji*********@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I am experienced with databases and sql, but lacking in vba skills.

Nov 13 '05 #3
Alan Webb wrote:
algorhythm


algorhythm = how some photosynthetic organisms practise birth control.

--
--
Lyle
Nov 13 '05 #4
Lyle Fairfield <ly******@yahoo.ca> wrote:
algorhythm = how some photosynthetic organisms practise birth control.


I thought it was a US politican on the drums.

Regards,
Keith.
Nov 13 '05 #5

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

Similar topics

18
by: Tad Marko | last post by:
Howdy! I'm trying to get my head around Python and I've come to realize that there are a lot of idioms in Python that are a bit different than in other languages. I have a class similar to what...
2
by: Sean Berry | last post by:
I was writing a little script to test different functions of the time module. Like an idiot, I named the test script time.py. Then when I tried to do a "import time" call, I got an error. So,...
5
by: Ben Jeurissen | last post by:
Hello, I have to deal with the following issue in C++: Two threads are started from the main thread, both capturing images from a different firewire camera. Both threads take shots of 460800...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
2
by: Jacob Kroon | last post by:
I'm writing a block-diagram editor, and could use some tips about writing/reading diagrams to/from an xml file format. The basic layout of my code : class Diagram { Blocks blocks } class...
36
by: Cap'n Ahab | last post by:
I have used VB3 - VB6, so learning all this OO stuff is reasonably new to me (although I looked at Java a few years ago). Anyway, I thought I would write a small class to begin with, with a...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
16
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and...
0
by: artursam | last post by:
STUDENT TABLE NAME DATA TYPE DESCRIPTION IDNO CHARACTER ID Code "Primary Key" COURSE CHARACTER Course DEPART CHARACTER Department LNAME CHARACTER Last Name FNAME CHARACTER First Name...
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: 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
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: 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
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
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
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.