Modify Data Using A Query

Jun 1, 2006

Hi all,

Is it possible to modify data using a query.

Say for instance I have a whole load of IP's in a table in the form of A.B.C.*, where and and B are fixed, C varies slightly and * can be anything from 1-255. Can I use a query to look at an IP and the append an IP record to a different table in the form of A.B.C.0. Basically, modifying the data so that whatever the value of *, it is changed to 0.

Cheets,

Matt

View Replies


ADVERTISEMENT

How To Modify Data Retrived Form A Query !?

Mar 27, 2006

i am very rookie with access.. infact i am doing my first project in access for a friend.. here is my doubt...

this frnd has toy making business.. he wants to keep track of this inventory... i have made one table (ItemId(PK), Item descripstion, noOff, parentItem(FK), stock)..
noOff is the no of child items required for a particular parent item..

now i have to run a query to get all the items which have same parentItem.. for this i designed a form... have put 3 text boxes and a subform.. one to accept the parentItem.. 2nd to display its description.. 3rd one to accept no of parent items which i wud be the multiplying factor for the child item noOff.. (default is one..)

http://img.photobucket.com/albums/v355/sledge045/171205/form_prd_data.jpg

now i can retrive the parentItem id.. from the form and use it in the WHERE clause...


SELECT ItemData.ItemID, ItemData.ItemDescription, ItemData.noOff
FROM ItemData
WHERE (((ItemData.ParentItem)=[Forms]![Display Product Data]![txtProdId]));


but i want to retive the value in the No off: box and multiply it to all the child item's no off...

i have tried to multiply ItemData.noOff with [Forms]![Display Product Data]![txtNoOff] but did not got the desired results....

i need help with this... or if u know ne other way to do it... plese post a reply... thanks...

View 1 Replies View Related

Queries :: Modify Access SQL To Exclude Data From Query

Apr 13, 2013

I have been successfully using the following statement in Access 2010 to retrieve data from a large csv relational database:

SELECT [1995_1].RPT_REC_NUM, [1995_1].PRVDR_NUM, [1995_2].WKSHT_CD, [1995_2].LINE_NUM, [1995_2].CLMN_NUM, [1995_2].ITM_VAL_NUM
FROM 1995_1 INNER JOIN 1995_2 ON [1995_1].RPT_REC_NUM = [1995_2].RPT_REC_NUM
GROUP BY [1995_1].RPT_REC_NUM, [1995_1].PRVDR_NUM, [1995_2].WKSHT_CD, [1995_2].LINE_NUM, [1995_2].CLMN_NUM, [1995_2].ITM_VAL_NUM
HAVING ((([1995_2].WKSHT_CD)="A000000") AND (Not ([1995_2].LINE_NUM)="09500") AND (([1995_2].CLMN_NUM)="0100" Or ([1995_2].CLMN_NUM)="0200"))
ORDER BY [1995_1].RPT_REC_NUM, [1995_2].LINE_NUM;

This query returns one long column of line numbers (LINE_NUM) representing the itemized salary (CLMN 0100) and non-salary expenses (CLMN 0200) and a total for each of the organizations represented in the data base. My question is: is it possible to modify the query so that it returns only organizations whose data passes that following test that checks to see if the itemized line numbers 00100 to 10099 equal the total for each organizations line 10100: SUM(LINE_NUM 00100:10099)=SUM(LINE_NUM 10100:10100).

I have tried several times to upload a sample file but have been prevented from doing so because of a missing security token. I have communicated this to the administrator.

View 9 Replies View Related

Modify Data Structure Using Code

May 4, 2008

I want to be able to make code that will modify a data structure in another file. Can I do it in an access application or will I need to make a VB application? I want to add some more fields to a table. :confused:

View 1 Replies View Related

Taking Data From Table1 Modify And Output To Table2

May 25, 2006

hey all,

bit of a head scratcher for me here.

i have a database and i need to be able to read all the records from table1 modify the data and output the data to table2 and I would prefer this to be done via just one button in a form so im guessing VBA need to be used.

table1 consists of an ID field, firstname field, lastname field and date field.

table2 has ID field, full name field, date field

so i want to read the first and last name and date from table1, merge the first and last name and then output the merged names and date to table 2.

ive googled around and all ive come up against is recordsets but im having a hard time actually getting them to even work.

any help is appreciated.

cheers

Matty

View 6 Replies View Related

Modify Query

May 18, 2007

Hi,

I create one database and the query and the forms for my clients in the sharing drive. Every time, the user open the form and select the field names and then execute the query depend on which fields the user select on the form, and then output to the screen. Here is the question, if there are multi user access the same form/query, one user pickup 3 fields to run the query, and another user pickup 5 fields to run the query. Becuase one user select 3 field names on the form, and then the code will modify the query contents, another user select the 6 field names on the form, and then the code will modify the query contents.

So, will the query affect each other?

View 1 Replies View Related

Modify Query

Apr 25, 2006

Dim strSQL As String

strSQL = "SELECT [Company Name],[Vendor Name],[Account],[Statement Number],[Amount] from [Statements] "

Dim cat As New ADOX.Catalog
Dim cmd As New ADODB.Command
Dim qry As ADOX.view
cat.ActiveConnection = CurrentProject.Connection
Set cmd = cat.Views("Statement Informations").Command
cmd.CommandText = strSQL
Set cat.Views("Statement Informations").Command = cmd

Set cat = Nothing
DoCmd.OpenQuery "Statement Informations"


I used the above code to modify the existing query, "Statement Informations".

When I run it, it give out the error message:

Run-time error '3218':
Could not update; currently locked.

And then, I went to queries section, and open the query "Statement Informations" directly, close the query, and then run the code again.
Then, it works.

I don't know why.
If I run it on next machine on other day, then it give out same error.

How can I solve it?
Please let me know, thanks.

View 1 Replies View Related

Modify Query For A Report

Jan 9, 2007

Hi all

I have a report rptTeamPickStats which source is a query qryTeamPickStats

The query has columns such as name, id number etc which are GROUP BY and hours, cases as SUM and there is a DATE field where I originally had a WHERE statement specifying the from and to dates.

I want to be able to modify the where using VB so I don't have to have several queries.

The code below doesn't work (probably won't take you long to realise that) but just to show kind of what I'm after.

I want to query all the TLName where the date is between to dates.

DoCmd.OpenReport myReport, acViewPreview, "", _
"[TLName]='" & myFilter & "' And qryTeamPickStats!Date >= #" & myFromDate & "# And qryTeamPickStats!Date <# " & myToDate & "# And [OTcode] " & myOp & " 'NA'"


Hope this makes sense

Cheers

Kev.

View 5 Replies View Related

Can't Modify Values In A Query

Feb 4, 2008

Hi!

It has happen to me many times that when I create specific queries I'm then not able to modify the values of em...

Do you know the possible causes of this?

Is it because I'm filtering? Ordering by? Grouping? Using fields of differents tables related 1-many? Calculated fields? Expressions? Modules?

----------

One specific case that has presented to me is a query that returns info from 1(main)-many(details) relationship. When I use the sorting of a field of the main table it doesn't allow me to edit values, tho when I delete this sorting it works fine.

Nevertheless, I also have another query which just returns values from one table and whether I use sorting or not, I can modify the values.

What's happening??? :( :confused:

View 1 Replies View Related

Can Anyone Modify This Query Statement

Apr 6, 2008

hi im a first time user of access,

can anyone modify this query statement...

select IDno, LName + ', ' + FName as Name, course, Status,
(select count(io.AC) from in_out_books io where io.IDno = b.IDno and io.DBorrowed >= '2008/03/01' and io.DBorrowed <= '2008/04/30' group by io.IDno
)
as TotalBooks
,
(select sum(io.Penalty) from in_out_books io where io.IDno = b.IDno and io.DBorrowed >= '2008/03/01' and io.DBorrowed <= '2008/04/30' group by io.IDno) as Penalties from borrowers b


i also want to set the TotalBooks and Penalties to 0 when their values are null thanks

View 3 Replies View Related

Running A Query To Modify A Field NOT Record

Feb 21, 2006

Is it possible to run a query/filter in order to hide/show a field in a record instead of it affecting the entire record.

What I'm trying to do is, in a form the user can enter information about a service call and they can enter a recommendation for the next visit. When they enter a recommendation they are able to select which month the recommendatin should pop up. This Service report get's printed on a monthly basis as a report. Now the recommendation field should only pop up if that particular month which was selected earlier is true. I've tried different methods, but it would affect the entire record as opposed to just one field.

Thanks.

View 1 Replies View Related

Modules & VBA :: Modify Progress Bar So Instead Of Saying Running Query?

Nov 8, 2013

Is there any way to modify the progress bar so instead of saying "running query" it states the name of the query?

Like: Running Query [qryFRED] <progress bar>

View 1 Replies View Related

Queries :: Modify Titles Of Query Fields?

Jan 17, 2014

I have a simple Query which very satisfactorily exports data to a Tab Delimited Text File to upload to a website.

The field titles are dictated by the Table Field Names but I would like to modify these for the export. Is there a simple criteria code by which this can be achieved.

View 7 Replies View Related

Can't Modify Fields In Form With Table INNER JOIN Query

Oct 5, 2004

Hello, exactly how Access 2002 and SQL operate is still a bit fuzzy to me.

In brief:
tableAccounts has fields for Signatory1ID and Signatory2ID, and other stuff
tableSignatories has ID for a primary key and has SignatoryTypeID as a field
tableSignatoryTypes has ID for a primary key and SignatoryType as a field

For each account, on a Form I want to show the Signatory and SignatoryType info for both signatory1 and signatory2. I have tried creating various queries and INNER JOINing the tables and/or queries together, but whenever I manage to get all the information displayed, none of it is editable. Access seems to lock the various text boxes and combo boxes.

Any thoughts?

View 2 Replies View Related

Modules & VBA :: Modify Working Code - Export Query And Update Worksheets In Excel Template

Mar 12, 2014

What I want to do instead is open an existing .XLSM wokrbook delete or update the 7 sheets it creates and replace them with the new query results from access.

I love this code below because it works really well but now I have a new requirement. I have a workbook that has a "dashboard" sheet that looks at the sheets from acccess and summerizes the data. So, I'd like Access to open that "template" excel workbook and delete the old sheets and put in the new ones..The required sheets to keep are called "Metrics", "Validation" and "Mara"

What I was trying to do for the past few hours was another work around which was to have Access run this code, then excel run some code to import the "dashboard" formulas but I can't get it to copy to another workbook because it links to the OLD workbook..Here is the working code that needs modding:

Code:

Option Compare Database
Public Function ExportAdvanced()
Dim strWorksheet As String
Dim strWorkSheetPath As String
Dim appExcel As Excel.Application
Dim sht As Excel.Worksheet
Dim wkb As Excel.Workbook
Dim Rng As Excel.Range
Dim strTable As String
Dim strRange As String
Dim strSaveName As String
Dim strPrompt As String
Dim strTitle As String
Dim strDefault As String

[code]...

View 3 Replies View Related

Modify All Records

Jun 21, 2007

Hello,

I have a form (linked to a table). I have 'txtBoxA' and 'txtBoxB'. Now, each record will have different values in 'txtBoxA' and based on that value 'txtBoxB' will change for that specific record. In the 'OnLoad' event for the form I type the code, but when I re-open the form it only works for the 1st record, and it doesn't change all the rest (records).
Do I need a loop to go through all the records?? I thought that this was done automatically by ACCESS. If I have to use a loop, can anyone please give me the exact syntax?

Please, this is really urgent so I would really appreciate an answer asap
Thank you very much.

View 2 Replies View Related

How To Modify A Field Value?

Jan 25, 2005

Hi,

I am trying to change the value of a field (well a few fields once I get it to work for one!) in a table.

I am trying to update the last record in a table, but cannot get any code to work in VBA for this and cannot make an update query select just the last record in the table to do it that way either!

The VBA I am using is:

Dim db As Database
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("Inventory Transactions", dbOpenDynaset)

With rst
.MoveLast
.Edit
![UnitsOrdered] = (Me.UnitsOrdered - Me.Qty_Passed_Insp)
.Update
End With
rst.Close
db.Close

Units ordered doesn't change though!


For the update query I am trying the following criteria for the transactionID field:

=max( [Inventory Transactions]![TransactionID] )

But this returns the error message:

"Cannot have aggregate finction in WHERE clause ([Inventory Transactions].TransactionID = Max([Inventory Transactions]![TransactionID]))"

Any suggestions?

Thanks in advance!

View 9 Replies View Related

Modify Auto ID Increment

Aug 22, 2007

Hello,

Can someone tell me how I can change the increment in an existing database.

The PK is currently Auto ID with each new record currently 1001, 1002 and so on.

What I am trying to do is say starting monday the next new entry begins at 5003 versus 1003, in essence I am trying to change my first number to a 5 versus a 1.

Is this possible?

Thanks..
Fen How

View 8 Replies View Related

Modify Browse Window

Mar 15, 2007

hi all

i'm hoping some guru can help me out here, i've got a function that opens up a browse window and lets me choose what sort of file type i want to view in a directory. what i need is to modify it so i can have the option of arranging the files by the date modified, so i can have the last file saved come up as the first file available.

anyone know if this is possible???

Code:Function ahtCommonFileOpenSave( _ Optional ByRef Flags As Variant, _ Optional ByVal InitialDir As Variant, _ Optional ByVal Filter As Variant, _ Optional ByVal FilterIndex As Variant, _ Optional ByVal DefaultExt As Variant, _ Optional ByVal fileName As Variant, _ Optional ByVal DialogTitle As Variant, _ Optional ByVal hwnd As Variant, _ Optional ByVal OpenFile As Variant) As Variant' This is the entry point you'll use to call the common' file open/save dialog. The parameters are listed' below, and all are optional.'' In:' Flags: one or more of the ahtOFN_* constants, OR'd together.' InitialDir: the directory in which to first look' Filter: a set of file filters, set up by calling' AddFilterItem. See examples.' FilterIndex: 1-based integer indicating which filter' set to use, by default (1 if unspecified)' DefaultExt: Extension to use if the user doesn't enter one.' Only useful on file saves.' FileName: Default value for the file name text box.' DialogTitle: Title for the dialog.' hWnd: parent window handle' OpenFile: Boolean(True=Open File/False=Save As)' Out:' Return Value: Either Null or the selected filenameDim OFN As tagOPENFILENAMEDim strFileName As StringDim strFileTitle As StringDim fResult As Boolean ' Give the dialog a caption title. If IsMissing(InitialDir) Then InitialDir = CurDir If IsMissing(Filter) Then Filter = "" If IsMissing(FilterIndex) Then FilterIndex = 1 If IsMissing(Flags) Then Flags = 0& If IsMissing(DefaultExt) Then DefaultExt = "" If IsMissing(fileName) Then fileName = "" If IsMissing(DialogTitle) Then DialogTitle = "" If IsMissing(hwnd) Then hwnd = Application.hWndAccessApp If IsMissing(OpenFile) Then OpenFile = True ' Allocate string space for the returned strings. strFileName = left(fileName & String(256, 0), 256) strFileTitle = String(256, 0) ' Set up the data structure before you call the function With OFN .lStructSize = Len(OFN) .hwndOwner = hwnd .strFilter = Filter .nFilterIndex = FilterIndex .strFile = strFileName .nMaxFile = Len(strFileName) .strFileTitle = strFileTitle .nMaxFileTitle = Len(strFileTitle) .strTitle = DialogTitle .Flags = Flags .strDefExt = DefaultExt .strInitialDir = InitialDir ' Didn't think most people would want to deal with ' these options. .hInstance = 0 '.strCustomFilter = "" '.nMaxCustFilter = 0 .lpfnHook = 0 'New for NT 4.0 .strCustomFilter = String(255, 0) .nMaxCustFilter = 255 End With ' This will pass the desired data structure to the ' Windows API, which will in turn it uses to display ' the Open/Save As Dialog. If OpenFile Then fResult = aht_apiGetOpenFileName(OFN) Else fResult = aht_apiGetSaveFileName(OFN) End If ' The function call filled in the strFileTitle member ' of the structure. You'll have to write special code ' to retrieve that if you're interested. If fResult Then ' You might care to check the Flags member of the ' structure to get information about the chosen file. ' In this example, if you bothered to pass in a ' value for Flags, we'll fill it in with the outgoing ' Flags value. If Not IsMissing(Flags) Then Flags = OFN.Flags ahtCommonFileOpenSave = TrimNull(OFN.strFile) Else ahtCommonFileOpenSave = vbNullString End IfEnd Function

View 5 Replies View Related

Modules & VBA :: How To Modify A Table

Dec 11, 2013

I want to modify a table called FC_TEMP via adding some columns from another table called AVERAGE_TRP. Do I have to create a new query table and then insert the output into a new table?The following code shows me : Cannot execute a selected query.Is there a way to update this FC_TEMP table without creating another temporary table?

Code:

Public Sub Update()
Dim strSQL As String
strSQL = "SELECT FC_TEMP.*,AVERAGE_TRP.[Average_new_TRP_EUR],AVERAGE_TRP.[Average_old_TRP_EUR],AVERAGE_TRP.[Average_Margin] " & _
" FROM FC_TEMP " & _
" INNER JOIN AVERAGE_TRP ON FC_TEMP.[PRODUCT_ID] = AVERAGE_TRP.[PRODUCT_ID]"

[code]...

View 5 Replies View Related

Comments Section, Modify Denied?

May 20, 2005

We have several users that access the same database. Is there a way to make it so that the users can add comments to the "coments" field on the form, but not remove any comments once saved?

View 1 Replies View Related

How Can I Modify The Standard Access Form?

Sep 18, 2005

Hi
I am getting fed up of repeatedly modifying the basic new form in Access 2003 since I hate Tahoma and I never want dividing lines and I always want the VBA to be Option Explicit and I have my own ideas on colour schemes etc. etc.
Every new form I enter I have to make all the changes manually and simply wondered if I am being an ass. I can modify templates in Word and Excel so if I could do the same thing in Access I could save myself cumulative hours of work.
I cannot seem to find anything so does everyone else bow to what Microsoft think a form should look like or do you all do what I do and endlessly recreate the same starting point for each form???
Any pointers would be 110% wonderful!!
Best wishes

View 3 Replies View Related

Modules & VBA :: Too Many Forms To Modify One At A Time

Jun 27, 2014

My problem is simple, and i imagine it is easy to fix. I have more forms in my db than I would like to count, and I have a couple lines of code to add to the onload event of each form.

Is there an way, without actually having to edit each form myself, to add the code i need to add to all forms. Is there some code I can write that will let me modify the on load property of a form, and save it?

I know what i need to do, minus the part where i actually change the onload event.

View 5 Replies View Related

Security - Not Letting Users Modify Tables

Jul 26, 2005

I have to make it so user group cannot modify/update/delete data in tables, but con do the same in forms. Yet if I uncheck those in 'permissions' it's not possible to change anything forms either

For some reasons management doesn't want tables to be in diff database

View 1 Replies View Related

Auto-modify User Form Input

Feb 2, 2006

I have a form where a user will enter a 11 digit number (12345043456). Using ASP (VB) this string of numbers queries an access database and returns the entry for that specific number to the user.

Unfortunately, the numbers in the access table are an 11 digit number with hyphens seperating the string like this 12345-04-3456 (the ndc # of a pharmaceutical).

So What i need is some code that monitors and modifies the form input so that the hyphens are added in to the string when the user is inputting the data.

If i cannot do this, then is there some VB that I can add which modifies the field in the text file when it is imported into access on a daily basis.


Thanks
Terrons

View 7 Replies View Related

Modify Default Values And Text Strings

Apr 4, 2006

Hello, I have two newbie questions. First, when I design a checkbox in Form design view, how do I program or script the form so it will enter a "1" value on the corresponding tables database per column. (Just like in the option group design, where a click on each option generates a specific value on the tables database).

Second, how can I design the form where it can accept text strings as input and displays them 'as is' in the corresponding tables database as a text string.

Thanks for looking. :)

View 1 Replies View Related







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