Replacing Query
May 16, 2007
hi. i are replacing queries in my tables to get the database ready to convert to SQLServer.
Am having a problem replacing a query that is brings in a table for a drop down and inserting the selection in the record.
during creation, the record shows a date, id, task, hours.
the datatable needs date, id, task_code, task_name, task_job, hours.
On "task" the drop-down allows for selection of several choices that are 3 columns wide. i can get the columns to show but only the first column currently goes in my new table. the table's columns that the selection comes from is "task_code,task_name, task_job". All columns are needed as different areas use the same task code but use different jobs or names.
I was told to use a insert into statement, however am having problems with it.
have as follows:
SQLStatement = "SELECT [Task_code], [Job_name], [Task_name] FROM tablea; "
rec.Open SQLStatement, , adOpenDynamic
job = rec(1)
task = rec(2)
rec.Close
SQLStatement = " Insert into [tableb]([Job_name],[Task_name]) " & _
" values (" & job & ", " & task & " ) "
rec2.Open SQLStatement, , adOpenDynamic
db.Execute (SQLStatement)
any point in the right direction would be greatly appreciated.
thanks,
slh
View Replies
ADVERTISEMENT
Jun 5, 2013
I am trying to replace a # character and all characters after in a text field.
U set up a Select query and used the following expression:
Expr1: Replace([Part Number],"[#]*","")
It doesn't change any of the records. Is this possible to do in Access 2007?
View 11 Replies
View Related
Sep 19, 2014
The following is a simplified version of a puzzle I'm faced with, but if I can solve the simplified version I'll be able to solve the real thing.
Take the following column:
MyField
1-2A-B
YZ-A6
53-75-XC
How within a query can I replace the hyphens with spaces but only where they appear between two numbers? So this is the result I'm after:
MyField
1 2A-B
YZ-A6
53 75-XC
(note that the letters and numbers could be any values in any positions.)
View 3 Replies
View Related
Dec 6, 2013
Can I use the append query to update a table by replacing all existing information with updated information while at the same time adding all data that isn't currently in the table?
Right now every time I run the Append Query it just adds the same information as a new row instead of replacing the existing row with the updated information.
View 8 Replies
View Related
Jun 21, 2007
I have a customer who made a query with a field that looks like that:
NewField: iif(Field1=True and Field2>100 and isnull(Field3);"Blue";iif(Field1=True and Field2>100 and not isnull(Field3);"Black";iif(Field1=True and Field2=100 and isnull(Field3);"White";... And so on, for miles and miles.
Although it works, and fast enough, I don't like the way it is displayed and I am sure that it could be even faster without all these iif.
Any idea about the best way for me to handle this kind of query?
Thanks!
View 2 Replies
View Related
Dec 19, 2007
I have a main table which contains data on Oilfields. This is set up with an auto number for ID and a name of each oil field. I have other tables which contain things such as Pipelines, Wells and Platforms, which are linked back the the main table.
The problem is that the database was given to me with the links being between the Oilfield_Name, and not using the Oilfield_ID (which is not present in the 'satellite' tables). How can i add the oilfield_ID column to the 'satellite' tables so i can link them properly?! (i can obvioulsy physically add an 'Oilfield_ID' column to the 'satellite field', but how do i populate it with all the correct IDs from the main table, to suit what is in the 'Name' column of the 'satellite' field- does that make sense?). I suppose I need to replace all of the Names with the IDs?
This has been giving me such a headache. The Oilfields table has 2500ish records, with as many as 1200 in the other tables linked to it.
View 7 Replies
View Related
Dec 11, 2007
Hi, Im building a DB that basically tracks the hours people have worked,
its all going fine apart from one major bug which i cant get my head around, I am trying to work out a way so that if someone decides to change the hours they have worked it replaces the existing record and does not create a new record.
Each record has a unique user ID attached and each day is dated, do you think this is a VBA solution or a change in the relationships perhaps?
Sorry fi there is already a similar answer to this question on the forum, but i couldnt find one!:confused:
Thanks in advance,
Paul
View 2 Replies
View Related
Oct 17, 2006
Hi, I have 2 tables with similar data. However I need to compare this particular field called CompanyName in both tables. Reason being human error/exposition data errors. For example, Chef Kitchen Holdings Limited, in one table it is Chef Kitchen Holdings Ltd while the other table is Chef Kitchen Holdings Pte Limited, they both are the same but Access recognise them as 2 distinct datas.
Therefore I need help in comparing datas between these 2 tables for this particular field. So long as there is 75% similarities, one of the 2 tables will have the data replaced.
Is that possible using Access? if not, how about excel? please suggest.
thanks.
View 4 Replies
View Related
Aug 1, 2007
OK, here is my situation. I have an access database which is updated automatically every night with new data. My companies solution to this is each morning, the entire database is downloaded to my computer to be used by another application.
In one of the tables, there is a field that doesn't work for my purposes, so each day I have to manually open the table, and change the contents of that field for every record. For example, lets say I have the following table:
Field1 Field2 Field3 Field4
Rec1 Wigets Faucet Model1A
Rec2 Wigets Faucet Model1B
Rec3 Wigets Sink Model1A
Rec4 Wigets Sink Model1B
Rec5 Wigets Toilet Model1A
Each day I manually change Field2 so it reads "Total" and whatever is in Field2:
Field1 Field2 Field3 Field4
Rec1 Total Faucets Faucet Model1A
Rec2 Total Faucets Faucet Model1B
Rec3 Total Sinks Sink Model1A
Rec4 Total Sinks Sink Model1B
Rec5 Total Toilets Toilet Model1A
Each morning when I receive the new database download, they all go back to widgets.
Is there a macro or module I can create to automatically look at Field3, and then assign a new value to Field2 based on Field3's value?
Any help would be appreciated!!!!
View 3 Replies
View Related
Feb 20, 2007
I am exporting an Access table as an xml file and need to be able to identify and replace '&', '(' and ')' as they are not accepted in xml.
Does anyone know how a query can be built which will find these characters in fields and update to ' and' or just remove?
Thanks
View 1 Replies
View Related
Sep 15, 2014
I am having a query, where a few date records are null because of no entry or record, what a want that the field with no date entry to be come up with zero "0" .
View 1 Replies
View Related
Mar 4, 2007
Attaching a sample mdb file. I have TABLE1, TABLE2 and QUERY1, QUERY2 in my mdb file.
I want Query1 Value 4 once in Query2. It should not be repeated again with [SBNO] values 5 time.
Value 4 in Query 2 shows with only 1st record and remaing 5 records shows 0 value instead of 4.
How is it possible.? Can anyone help me.
View 3 Replies
View Related
Sep 5, 2004
Hi, can anyone tell me how to replace the data in one table with data from a backup table? I've tried:
Insert into Customer
Select *
From CustomerBackup;
but I keep getting key violations.
View 1 Replies
View Related
Aug 19, 2004
I created a database that has a field called "Corrective Actions." I want the user to be able to type in a series of numbers, in the following format: 001, 002, 051, 123. Each number has a certain meaning. For example, 001 means "Upgrade to current revision," 002 means "Replace Unit," and so on. Here is what I would like to happen: The user will type in the numbers in the appropriate format. When the user presses the tab key to go to the next field, I want the numbers to be replaced with the actual meaning. My problem is that I can not figure out how to accomplish this. Can anyone help me?
View 5 Replies
View Related
Aug 29, 2005
Hi. I have a database which store the subject title of the mailto link using the upload form. I would like to construct a mailto link that picks up the suject title from my database. However, there are spaces in the subject and the mailto link cuts off at the first spacing. In my display page, I would like to replace the spaces with %20 but have had no success with any attempts.
This is the code that add the data to the database
rs.AddNew
rs("File Name") = fileName
rs("File Size") = fileSize
rs("File Data").AppendChunk fileData
rs("Content Type") = contentType
rs("Title") = "<td valign=top><table width=100% border=0 cellspacing=3 cellpadding=0><tr><td valign=top bgcolor=#a1be1e><font color =white><span class=mainNav4 style5>" & Title & " </span><span class=bodyC2 style5> </span></font color></tr>"
rs("Text") = "<tr><td valign=top><span class=bodyC2>" & Text & " </span>"
rs("Price") = "</span> <span class=style6><strong><font color=#FF6600> " & Price & "**each</font></strong></span>"
rs("Note") = "<br><span class=style6><em><font color=#a1be1e> Note:** " & Note & " </font></em></span><span class=bodyC2></span></td></tr>"
rs("Button") = "<tr><td><br><a href=mailto:GM@acx.com.sg?subject=" & Button & " class=outlinerCen> Enquire </a><br><br></td></tr></table></td></tr><tr><td colspan=2 valign=top><span class=dottttt>.................................................. .................................................. ...</span></td></tr></table><br>"
And this is to display
If NOT rs.EOF Then
Response.Write "<body><table width=350 border=0 cellpadding=0 cellspacing=5><tr><td width=5 valign=top><table border=0 cellpadding=0 cellspacing=0 class=outlinerProducts><tr><br><td><img src=""file.asp?ID=" & rs("Id") & """width=130 height=130></td></tr></table></td>"
Response.Write rs ("Title") & "<br>"
Response.Write rs ("Text") & "<br>"
Response.Write rs ("Price") & "<br>"
Response.Write rs ("Note") & "<br>"
Response.Write rs ("Button") & "<br>"
rs.MoveNext
end if
Some assistance would be appreciated. Thank you.
Wolf
View 4 Replies
View Related
Jul 1, 2014
I have a table (which has a few relationships) that contains 10.000 records up-to-date, but I've been making major changes to my database working on an old version from early June, when it had +9000 records.
What I'm planning to do to update the table:
export those 10.000 (up to date) records to a Excel file
delete those outdated +9000 records manually (select all + supr)
import the data from the Excel file so my new database is up-to-date again .
Is this acceptable or could lead to weird errors in the future?
View 2 Replies
View Related
Sep 1, 2012
I have info in Excel workbooks coming from various individuals. I take bits and pieces of data from each and the update an Access DB. Is there a way to simply replace the table in Access without affecting the relationships that the current version of the table has?
View 2 Replies
View Related
Apr 25, 2007
Hi
I am trying to replace the numeric values of a field with a text in querry using Choose function, something like this aa5:
Choose([a5]-1="one";[a5]-2="two";[a5]-3="three";[a5]-4="four")
But it is not giving me no results :(( I am missing something but I do not what. Maybe I should use some other function?
I hope someone will help me!
View 1 Replies
View Related
Sep 10, 2007
Hi,
i have created a query from just one table, which is basically a list of Financial transactions.
There is a field called supplier code, in this query.
Most of the transactions have a supplier code, but there are a few that don't.
i've got another table that has the supplier name against the supplier code.
i want to bring this table into the query, so that i can show the supplier names against those records in the query that have a supplier code.
when i add this table and link the 2 tables up and put the supplier name into the query. The query excludes the records with no supplier code.
This is presumably, because they contain null values.
I've been reading about the Nz function and i think this is what i need to use.
i've tried this, but it still only brings through the records with a supplier code and not all of them.
How i've done this is to go into the design mode of the query and in the column that would have null values i have click "build"
in here i have the following formula.
Nz([Supplier Name],"No")
Am i doing anything wrong?
View 2 Replies
View Related
Apr 30, 2008
Is it possible to create the following logic in query:
"If there is a "SHIFT2" or "SHIFT3" value on the last Friday in month,
then change the date values for these entries to the next date (Saturday)"
In the attached sample, there is a number of such values within the "Adv Track Shift" field dated on Friday 04/25/08 in the "shift_date" field. The logic should replace the applicable dates to Saturday 04/26/08. This should work for any month, regardless if it finds either of the two shifts or both of them.
View 4 Replies
View Related
Oct 27, 2005
hey guys
i'm trying to do something that i thought would be pretty simple. what happens is i have 2 files that get used, one by access and one by excel. they are both the same, except if one gets modified then the other doesnt obviously. (theres reasons for having the 2 files).
anyway. in access i want it to pick the newer of the two files (i assume this is using a fso system object?), if the one it normally doesnt use is newer, it should copy the new one over the old one and continue using the one it normally uses.
i cant simply use the other file as another user always has that file open.
any sample code on how to check if things are modifyed at a later date? and copy/pasting using those fso objects?
cheers guys
aaron
View 2 Replies
View Related
Aug 31, 2006
Is there a way to over-ride the message box which is automatically generated when you use the Wizard button to create command buttons?
ie. When you create a button through the wizard to delete a record it says "You are deleting one record" is there a way to override that message and put another one
i look at the code but I cannot see where the message part is inputted.
I realise that i can probably write the code long hand but (always) looking for a quicker way.
View 1 Replies
View Related
Mar 5, 2014
My table (excel spreadsheet) sits on another directory from the DB. If I delete the table on this directory and immediately replace it with a table with the same filename, format, etc (only the data has changed) will each database user have to relink the table on their desktop DB? Or will the forms/subforms/reports still maintain their relationships/functions and just display the new data?
View 2 Replies
View Related
Sep 12, 2014
I have a module that creates records into a contacts table in my access database. When there is no data in the field from outlook, the data is populated as an empty string "" instead of a null value, creating problems with subsequent queries and processes. I'd like to create the data as a null value but the module keeps failing with "object is required" on the statement
rstImport("Customer ID").Value = System.DBNull.Value
It doesn't seem to like System.DBNull.Value or DBNull.Value, and when I assign the vbNullString constant instead, it gets set to "" again and not null.
View 5 Replies
View Related
Sep 29, 2014
I need to create a query that combines two columns (lets say Column A and Column B for example) however the problem is that whatever non-null values that are in Column B must replace any value in Column A. If Column B has a value that is null then Column A's value is shown.
I have an example of what I'm working with (access file) and what result I want (excel file).
View 2 Replies
View Related
Feb 23, 2013
I'm building a database to calculate yearly fees for customers. I have a list coming from our accountancy-database that shows a field with the clients name & surname combined and I have a table named 'customers' that contains the clients names & surnames as separate values.
The first table (let's name it "accountancy") thus contains a field "Customer". Example data in this field:
"John McLane"
"John Doe"
"Marcy Free"
"Zino Withers"
The second table ("customers") contains the fields "ID, name, surname". Example data in this table:
1;"John";"Doe"
2;"Marcy";"Free"
3;"John";"McLane"
Now, what I'm looking for is a way to replace the 'Customer'-field in the first table by a lookup field that contains the correct ID for that customer in the 'Customers'-table.
Lucky thing: there are no doubles in the customer's table, so no two customers have the same name AND surname.
View 6 Replies
View Related