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 Replies
ADVERTISEMENT
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 3 Replies
View Related
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
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
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
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
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
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
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
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
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
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
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
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
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
Dec 22, 2014
I can manually stop the AutoExec macro from running by holding down the shift button - how do you do it by VBA? I'm opening the db from Excel, and I don't want the Switchboard to display ...
View 1 Replies
View Related
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
Aug 23, 2006
Hi
In my database i have a field called product code which the user enters the code as T0001, T0002, T0003 and so on for each record.
would it be possible when adding a new record for that field to auto fill the product code as T0004 for example, so the user doesnt have to type the code in all the time.
please help, ty
View 1 Replies
View Related
Jul 28, 2015
I'm struggling to get my database to auto split up a Query by a certain Column and automatically get it to export into separate Excel files.
I have got the export sorted, currently set to export the whole query, but i'm struggling to do the splitting up.
View 3 Replies
View Related
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
Mar 20, 2006
we use access database for printing lab reports. and a small graph is also printed on this report from another software(not an access application).
what i have done is that first we print the txt report from access and then use the same paper to print graph on it. I have alligned the report in such a way that these two reports fit perfectly.
we have to print twice and sometimes the graph is deleted in the other application, so we have to make the graph again.
what i want to do is:
1) prepare graph in the other application.
2) take a screenshot of it.
3) save this as an image file (jpg or bmp)
4) reference this picture in the access application and print it with the report.
So the problems are:
1) when i take a screenshot, how do i save it as a file,
2) how do i just get the area of the graph and remove all extra space. (usually all the other space is white as background)
View 6 Replies
View Related
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
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
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
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
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