Replace Macro With Code

Nov 13, 2006

Hello,

I have a macro that I used to import data into my database.
I use the transfertext action with the following specifications:

TRANSFER TYPE: Import Fixed Width
SPECIFICATION NAME: MYSPEC
TABLE NAME: MYTABLE
FILE NAME: \S0000FTESTMYFILEFILE.txt


The macro also contains and ECHO Yes after that event.

Is there a way I can write the above with code and not use the macro? I would like to add this code on a cmdbutton.
Thanks.

View Replies


ADVERTISEMENT

Code/macro To Do Auto Replace

Nov 22, 2004

I am looking for a way of creating the following:
I want to be able to click a command button and have it prompt the user for input.
Then take the input and replace all cases of NA with that string in field B for all records.
I would prefer to have no other prompts other that the user input and a success msg box.
Can this be done?

View 4 Replies View Related

Find Replace Macro

Feb 21, 2006

I have a field that I am running a few queries on. What I want to do is run a macro when the form is opened.

I have been looking on how to write a query that will convert any space within a string to a "+". I cant figure it out...

IN the first part of the macro I am setting the field up so I can hyper link to Mapquest. My problem is that the link wont work with the spaces I have in my address field. So i figure after I running the first query to create the string below, I could then run another query to replace all spaces with a "+"

"http://www.mapquest.com/maps/map.adp?formtype=address&country=US&address=" & [HOUSE_NUM] & "+" & [STREET] & "&city=" & "Some+City" & "&state=" & "TX"

Any thoughts?

View 5 Replies View Related

Find And Replace Within A Macro

Dec 20, 2011

I have a large macro with a lot of actions to run reports and export them to a shared drive. I basically need to copy the macro, but make it run a different query/report. Is there any way to do a find and replace to change the query and report name within the macro in one step, opposed to going through all the action lines and changing it?

View 1 Replies View Related

Find And Replace Query Or Macro

Dec 3, 2007

ne1 help me with a find and replace query or macro. What I'm trying to do is shorten the path to external PDF files after I inport them into field TxtPDFPath.

Example; after inport of files path reads
c:w2kdatapdffiles2005somepdf.pdf
c:w2kdatapdffiles2005januarysomeother.pdf
c:w2kdatapdffiles2006another.pdf

I would like to shorten all imported paths to
pdffileswhatever

Example;
pdffiles2005somepdf.pdf
pdffiles2005januarysomeother.pdf
pdffiles2006another.pdf
and so on

View 13 Replies View Related

Macro To Find And Replace With Checkbox

Jul 21, 2015

I have a database in which the user can select records to print via a checkbox (Yes/No | True/False | -1/0 as the case may be) and then a query that runs through a form to show the list of the records selected with the Print checkboxes as Yes | True | -1.

I want to include a button to change the checkbox for each record from Checked back to Unchecked (Yes back to No | True back to False | -1 back to 0).

Rather than have to Uncheck each individual record, I'd like to have a Macro or Code that will do all the displayed records in one hit.

I have looked at Code and Macro but can't seem to find "Find and Replace" type action that will allow me to do it all in one go.

View 3 Replies View Related

VBA Code To Search And Replace When String Ends With A Value

Sep 11, 2012

I have the following in Column A

url.com?valueA
url.com?valueA&valueB
url.com?valueC

I need a function that

If string "ends with" valueA or ValueC, then replace it with ValueD

View 2 Replies View Related

Modules & VBA :: Code To Replace Special Character With Space

Jun 12, 2015

We have a spreadsheet that i upload onto a table, i use on of the fields to build a file path but if there is a special character it causes problems,i need to replace the below with spaces if they are in my field called path

< (less than)
> (greater than)
: (colon)
" (double quote)
/ (forward slash)
(backslash)
| (vertical bar or pipe)
? (question mark)
* (asterisk)
. (full stop)
, (commer)

how i can do this in some sort of update query.

View 1 Replies View Related

Modules & VBA :: Replace Hard Code Directory Path With Textbox

Jun 17, 2013

How do I direct the ZipFilePath and ZipFolderPath to use a directory I define in a textbox in a form? Instead of hard code like it is now?

Option Compare Database
Option Explicit
Public Sub NewZip(ZipFilePath)
On Error GoTo Err_NewZip
Dim lngFile As Long
lngFile = FreeFile

[Code] ......

View 2 Replies View Related

Modules & VBA :: Replace Line Of Code During Split Form Front End Deployment?

Aug 11, 2015

I have a database that I've split and have deployed to 7 persons.

The thing is, I have three (3) forms:

Form 1
Form 2
Form 3

...that require changing a portion of a line in each form's respective VBA codes. I need to change the directories to where an excel workbook is stored after exporting, and another is where same excel is moved to after being uploaded.

At the moment, during deployment I have to manually change the directories.

I was thinking of maybe a pop-up form with four (4) fields that allows the user to select his/her name at the start-up of their frontend app, and paste the directories in the other text boxes provided.

This information will then be used to replace the directories in the VBA.

If I were to make changes and have to redeploy, I would have to do everything manually again.

View 6 Replies View Related

How To Run Data Macro Using VBA Code

Jun 18, 2015

I try to run Data macro using VBA Code.

Code:
Private Sub cmdRunDataMacro_Click()
DoCmd.SetParameter "prmMetalID", Me.cmbMetal
DoCmd.RunDataMacro "Metal.GetMetalParameter"
DoCmd.SetProperty txtTestMetal, acPropertyValue, [ReturnVars]![retPrice]
End Sub

View 2 Replies View Related

[ACCESS 2007] Use VBA Code Instead Of A Macro

Jul 26, 2007

Hello,

When I add a butten using the wizard Access 2007 adds a macro instead of vba code.
How can I get the good old VBA code???

Thanks for your help in advance

View 11 Replies View Related

How To Add A New Record In A Table By Code Or Macro?

Nov 8, 2007

I have a simple table of Customer names. It's as simple as two fields involved:

CustomerID
CustomerName

How can I use VBA code or macro to add a new record to this table? I'm a newbie, so if possible, please provide a few lines of example codes. Thanks.

View 6 Replies View Related

Set Web Control Scroll Bar Value - Code / Macro

Sep 8, 2014

I have a Web Browser Control which displays the location of premise from a table using Bing. The Control itself isn't large enough to show the entire Bing page, so it has vertical and horizontal scroll bars.

It's vertical position is fine, but I'd like it to by default display from the far right hand side as opposed to the left. I'm guessing there's a way to set the ScrollValue (or similar) of the horizontal bar in code, but am unsure what to do. Or perhaps there's a really simple way and I'm missing it.

I've done quite a bit of searching, but keep coming up for solutions for List / Combo boxes etc.

View 4 Replies View Related

Macro To Auto Filter - Show Records With Same Code

Jun 14, 2012

I have a form that has numerous fields, there is one field that is called the "Relationship Code" it gives any customers who have a certain relationship a 3 digit number. I would like a command button that you can press that will take the current record shown and filter their relationship code, to only show those records who have the same code. I know this can be done by going to the field>right clicking>and saying Equals " ". But I want a button with code that will do this automatically.

View 1 Replies View Related

Queries :: Make Replace Query To Look In Order To Find What To Replace

May 6, 2014

I have this working query:

Code:
INSERT INTO TB_SISTEMAS ( LOGIN, SISTEMA, PERFIL, DATA )
SELECT Left([dbo_BACKUP_ACESSOS.LOGIN],255) AS LOGIN, dbo_BACKUP_ACESSOS.SISTEMA, Left([dbo_BACKUP_ACESSOS.PERFIL],255) AS PERFIL, dbo_BACKUP_ACESSOS.DATA
FROM dbo_BACKUP_ACESSOS
WHERE (((dbo_BACKUP_ACESSOS.SISTEMA)<>"ACTIVE DIRECTORY") AND ((dbo_BACKUP_ACESSOS.DATA)="2014-03-23"));

But Iwant to be able to use a set of data to be used in the Replace Statement, so I create a table to add each string I would like to have replaced by "nothing", and trying to make the replace query to look there in order to find what to replace.I also created a table where I will list the systems that I dont want in the select, so I removed the "ACTIVE DIRECTORY" and replaced by the colum that have the list of system I dont want listed.This is the result:

Code:
INSERT INTO TB_SISTEMAS ( LOGIN, SISTEMA, PERFIL, DATA )
SELECT Replace((Left([dbo_BACKUP_ACESSOS.LOGIN],255)),[PREFIXOS_E_SUFIXOS]![Valor],"") AS LOGIN, dbo_BACKUP_ACESSOS.SISTEMA, Left([dbo_BACKUP_ACESSOS.PERFIL],255) AS PERFIL, dbo_BACKUP_ACESSOS.DATA
FROM dbo_BACKUP_ACESSOS
WHERE (((dbo_BACKUP_ACESSOS.SISTEMA)<>[SISTEMAS_EXCLUIDOS]![Sistema]) AND ((dbo_BACKUP_ACESSOS.DATA)="2014-03-23"));

The thin is that this keeps asking me to enter the parameter value for "PREFIXOS_E_SUFIXOS!Valor" and for "SISTEMAS_EXCLUIDOS!Sistema"

View 6 Replies View Related

Modules & VBA :: Write A More Complex Macro That Will Start Another Macro At Preset Time

Dec 8, 2013

I am trying to write a more complex macro that will start another macro at a preset time, however I am getting stopped at the first hurdle - getting a macro to run another macro.

Here is the code i am using at the moment, all I want to do currently is click the first button, then get the second macro to execute. But no luck, getting error 2157 "cannot find the procedure"

Code:
Private Sub Command3_Click()
MsgBox "1st macro running", vbExclamation, "Note"
Application.Run "teststart1"
' Application.OnTime TimeValue("19:55:00"), "teststart1"

[code]....

View 1 Replies View Related

Please Review This Code, (simple Code) New With Codes

Feb 16, 2006

Works great, but when I hit the number "3", (3 times in row) it will let me into the form. I want it to not let me in IF I don't know the password.

Where did I go wrong?

Private Sub Form_Load()
Dim pw As Variant

If InputBox("What is the password?", "Password") = "1" Then
Else
MsgBox "Invalid Password", vbCritical, "Sorry Charlie"
DoCmd.Close
If InputBox("What is the password?", "Password") = "2" Then
Else
MsgBox "Invalid Password", vbCritical, "Sorry Charlie"
DoCmd.Close
End If
End If


End Sub

View 14 Replies View Related

Using Code To Unprotect And Protect Viewing Code

Jan 14, 2007

I protect my code from people being able to read it by setting a password on the code from Tools > Properties, selecting the Protection tab and entering a password, and clicking "Lock Project"

Is there a way to write code that will remove that Lock Project check and check it back on?

I've looked through the Application.SetOption command and it doesn't seem to be one of the choices. It would be very helpful if someone knew how to do this.

Thanks

SHADOW

View 6 Replies View Related

Replace Vbcrlf

Dec 5, 2005

How do I replace vbcrlf in a string with "NN"

I have tried putting vbcrlf and "NN" as parameters into this but it doesn't work (maybe it can't see vbcrlf as a separate word!)

Function ReplaceWord(strText As String, _
strFind As String, _
strReplace As String) As String

' This function searches a string for a word and replaces it.
' You can use a wildcard mask to specify the search string.

Dim astrText() As String
Dim lngCount As Long

' Split the string at specified delimiter.
astrText = Split(strText)

' Loop through array, performing comparison
' against wildcard mask.
For lngCount = LBound(astrText) To UBound(astrText)
If astrText(lngCount) Like strFind Then
' If array element satisfies wildcard search,
' replace it.
astrText(lngCount) = strReplace
End If
Next
' Join string, using same delimiter.
ReplaceWord = Join(astrText)
End Function

View 1 Replies View Related

Find & Replace

Aug 21, 2007

I have some database, I need to replace empty cells one column with some data.
But Access does not do it.

Any suggestions?

View 1 Replies View Related

Help With Find And Replace

Jul 17, 2007

is there any simple way to find and replace wildcard character- I have a large data table with text as sample below- I would like to remove |00


2901-0206|00


Thanks

View 1 Replies View Related

Expression To Replace / With _

Jun 23, 2005

i have a table that has a column containing a letter reference a / and then another reference ( EG. AAA/A56457A, ght/6577654ghf, etc ) and i want to replace the / with a _

whats the easest and quickest way to do this as an expression

best regards

View 1 Replies View Related

Replace In Query

Dec 14, 2006

Hi Guys,

Need a little bit of help, I have a report I pull out of an inhouse system with sales, shortages etc. I want to use a query to alter the formatting slightly and append it in to a different table. Most of this i can do fine, except for one thing.

Two of the sales fields in my report I'm uploading come out in the following text format:
19.0PC
27.0PC
45.0PC
etc...

I need to change this before appending as its going in to a number field, all i need to do is lose the PC, e.g.
19.0
27.0
45.0
etc...

I can do this manually, it's a simple find and replace in excel before uploading, gowever I want to automate this as much as possible. Looking around I'm pretty sure it can be done in a query using the REPLACE function but I'm unsure on the formats to use.

The only other thing is once its converted even though it will visually be a numbe (e.g. 45.0) it will still technically be a text field, will this prove a problem on the appending?

Many Thanks

Paul

View 1 Replies View Related

Multiple Replace

May 18, 2007

Hi,

I am currently working on a project where i need to try and compare a list of organisation names held by my organisation and another organisation (around 20000 records each).

To take into account differences in how the organisation names may have been entered I'm wanting to strip out things like ltd, limited, company, co, &, and , and so on. I've tried using IIf and replace which works ok if the organisation name only contains one of the substrings I want to replace but not if contains more than one.

How do i go about doing multiple replaces in the same string?

View 4 Replies View Related

Replace All Query

Aug 14, 2007

Hi, i have a table of data, with a user name, and a task.

Each user is assigned many tasks, i and i would like to create a query that replaces all instances of a certain name with another name. How would i do that?

Thanks

Sean

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved