Modules & VBA :: Input String In Column Based On Data In Another Column?

Nov 30, 2014

I need to input a string into a column named "EventType". The code should first check if the column "Agent Name" contains any strings. If there is none, it will input "IBM Director" into the EventType column.

Once it has looped through the agent names, the code will then loop through the Details column and input into EventTypes based on what is displayed within the string.

These are the codes that I am using to achieve this, however nothing is being input into the EventType column.

Code:
Private Sub Command11_Click()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Final")

[Code] ....

I think the problem lies with the code that checks the agent name. When I removed it, it managed to populate the EventType column based on the details. But I still need to find out how to check the agent name too.

View Replies


ADVERTISEMENT

Modules & VBA :: Use Different Column Based On User Input To Update Data

Jun 29, 2015

I'm attempting to build an import module so that my users can take data from different walks of life and import it into my tables. I'm doing this by setting up a module and allowing the user to specify which column data will come from when importing data. So lets say I have a field that is CustomerID in my table and user one pulls data from 1 place and in his excel or csv file, customerid is in field 1. Another user does the same thing and its in field 2.

How can i make some form of a loop that when I'm attempting to update data, i pull the correct column?

strSQL = "SELECT * FROM tblImportTable"
Set rst = db.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)
With rst
Do While .EOF = False
If IsNull(DLookup("DefaultValue", "dbo_tblImportTemplateDetails", "Template_ID=" & Forms!frmImport!TemplateName & " AND FieldName='CustomerID'")) Then

[code]....

View 6 Replies View Related

Modules & VBA :: Convert Number Column Into String Column

Feb 28, 2014

I want to convert a number column into a text column.

Number Column is called Customer.

Below I can't match to the other table containing the text column Customer No.

How can I convert columns in vba?

Code:
strSQL = "SELECT CALCULATED_Forecast_TNS.*, USEFUL.TRP_in_EUR " & _
" FROM USEFUL INNER JOIN CALCULATED_Forecast_TNS ON (CALCULATED_Forecast_TNS.[Reference No] = USEFUL.[Reference No]) AND (USEFUL.[Customer] = CALCULATED_Forecast_TNS.[Customer NO])"

Set qdf = CurrentDb.CreateQueryDef("REPLACABLES", strSQL)

DoCmd.RunSQL "UPDATE REPLACABLES SET CALCULATED_Forecast_TNS.TRP_in_EUR = USEFUL.TRP_in_EUR"

View 1 Replies View Related

Modules & VBA :: Writing 2 Column Data Into 1 Column

Sep 18, 2013

I have a table that contains:

item | quantity
123 | 1
456 | 10
789 | 4

I need to get this data listed into a table that just has item and for it to look like this:

123
456
456
456
456
456
456
456
456
456
456
789
789
789
789

I understand and have accounted for the obvious primary key issue.how to get the data to display out like this.

View 1 Replies View Related

Modules & VBA :: How To Make One String Contains All Of A Column

Jul 25, 2013

i want to make a string that contains all of the fields in a column.

I have a table called UserSelectedComponentT with a column called ComponentName.

I want a string that is essentially all the different component names seperated by a " + " .

View 4 Replies View Related

Populating A Column In A Table Based On Values In An Existing Column

Mar 5, 2007

Hi all,

In the organisation that I work for employees get paid every 2 weeks on a Saturday. So for this financial year the pay period end dates have been 08/07/2006, 22/07/2006, 05/08/2006 etc


I have a column in an Access table listing various dates. I want the next column to be
populated with the next pay period end date after that date.

So if DATE is 05/07/2006 I want PAY PERIOD END to be 08/07/2006
and if DATE is 09/07/2006 I want PAY PERIOD END to be 22/07/2006 etc

How do I do this?

Kind Regards,

Matthew

View 1 Replies View Related

Queries :: Change In Column Based On Base Query Column

Mar 24, 2014

I have created a cross tab to extract pipeline and sales for Q1 2014, Q2 2014, Q3 2014 & Q4 2014... the user can select the quater from a multivalued text box...

Now for the final output, have created another query which pull the above four quarter in each column from the cross tab...now the problem arises when i change the quarter to Q2 2014, Q3 2014, Q4 2014 & Q1 2014..it gives an error "Microsoft office Access database does not recognizes "Query name" as a valid field name or expression".

The error is because the second layer of query does not identifies Q1 2014.

How do i make access change the column automatically when the Q1 changes to Q2...

View 1 Replies View Related

Reports :: Same Column Continuing Data String On Same Page?

Jul 10, 2013

I have a report that has only 2 columns (Routes and Carriers)

The report extends downward and takes up 3 pages.

I want all of the data on one page and when the data string extends to the bottom of the page, i want it to start over again at the top of the page (right where it left off at the bottom)

so i'd like it to look like the following all on one page

Route Carrier Route Carrier Route Carrier
AAA-1 Star AAA-7 Behnke AAB-4 Star
AAA-2 Titan AAA-8 LaidLaw AAC-1 Star
AAA-3 Star AAA-9 Star AAC-2 Titan
AAA-4 Universal AAB-1 Star
AAA-5 Star AAB-2 Star
AAA-6 Star AAB-3 Universal

View 1 Replies View Related

Modules & VBA :: SQL Query Field Based On A String From Input Box

Sep 10, 2013

How do I use a update sql query to update a field based on a string from an input box. Heres what i have been trying:

Code:

Dim NETWORKBOX As String
NETWORKBOX = InputBox("NETWORK TO IMPORT" & Chr(10) & "EXAMPLE: PRIMARY", "NETOWRK TYPE")
sql = "UPDATE " & TABLENAME & " SET NETWORK = " & NETWORKBOX & " ;"
DoCmd.RunSQL sql

If i run the code and input 'PRIMARY' in the NETWORKBOX the sql query will return an 'enter parameter value dialog box' with the word 'PRIMARY' above the input field.

View 1 Replies View Related

Queries :: Run A Simple Update Query To Copy Data From One Column To Another Column

Sep 24, 2013

I am trying to run a simple update query to copy data from one column (Addrl1)to another column (Working_Addrl1) within the same file and I can't for the life of me figure it out. Then I need to repeat for addrl2 and addrl3 to working_addrl2 and working_addrl3.

View 7 Replies View Related

Moving And SORTING Multiple Column Data Into One Column

Feb 25, 2008

Hi. I have a question I'm hoping someone can help me with. I would like to take data from multiple columns and put the data into one column. Additionally, I do not want to exclude any data (union all) and I would like to group the resulting union by another field. For example:

Original data layout:

Column Headings: Sample Event, Depth 1, Depth 2, Depth 3,
1st Row Data: 1, 6, 9, 12, 9
2nd Row Data: 2, 7, 9, 8, 3

Desired data layout:

Column Headings: Sample Event, Depths
1, 6
1, 9
1,12
1, 9
2, 7
2, 9
2, 8
2, 3

So far I'm using the following SQL. What do I need to add or change to get my desired result of grouping the unioned depths by the 'sample event' field?

I appreciate any help anyone may have to offer. Thank you.

SELECT Depth1 AS Depths
FROM Depth_Velocity_Substrate_Correct
Union all
SELECT Depth2
FROM Depth_Velocity_Substrate_Correct
Union all
SELECT Depth3
FROM Depth_Velocity_Substrate_Correct
Union all
SELECT Depth4
FROM Depth_Velocity_Substrate_Correct
Union all
SELECT Depth5
FROM Depth_Velocity_Substrate_Correct

View 5 Replies View Related

How To Highlight One Column And Change All Data Inside Of That Column To Same

Aug 18, 2011

I have a Access 2003 file and I want to filter anywhere where there last name is "expired" and change the column first name to say "no". How do I do that?

View 1 Replies View Related

Modules & VBA :: Get Column Name Based On Record

Jun 26, 2013

I have a table with 3 columns (Col1, Col2, Col3).

I have a record like: Col1=A, Col2=B, Col3=C.

I want to be able to do a sort of DLookup but searching all columns for "C" and returning the name of the coloumn "C" is actually in (Col3).

Is that possible at all?

View 3 Replies View Related

Modules & VBA :: Update A Column With Its Last Value And Concat To Value Of Another Column

Apr 16, 2015

DoCmd.RunSQL (" update tbl_userinformation SET [05-Henrichpiramid] = Yes where Username= Text146.value AND actualdate=Text148.value ;")
DoCmd.RunSQL (" update tbl_userinformation SET [combination] = [05-Henrichpiramid] where Username= Text146.value AND actualdate=Text148.value ;")

i want to update the column combination to its last value with concatanation to the value of current column.

View 11 Replies View Related

Copy Data From A Column In One Table To A Column Another.

Jul 18, 2007

Please would you be able to advise me how I would copy data from a column in one table to a column another table.

But I need to only use table not a query.

Thank you in advance for your help.

View 10 Replies View Related

Split 1 Column Data Into 2 Separate Column

Oct 5, 2005

Hi,

I need a query that could split data into 2 different field.
The table pic is attached for your ready reference. I tird with Left & Right funtions with no results.

Any one can help me please.

Table name is Agcad and field on which I need to split is Board_Size. The problem is Board_Size data is sometime in 3 digit (first half part) and sometime second half part is in 4 digit. It is a text data type field.

Thanks in advance...
Ashfaque

View 1 Replies View Related

Can You Create New Column In A Query Based Off Of Data From Two Columns Already There

Feb 4, 2008

I will need to create a new column in a query with data based off of two columns currently in my DB.

Current fields are: [TestType] & [TestReason].
New TEMP field will be [TestCombo]

TestType has 4 possible option via drop down.
TestReason has 21 possible options via drop down.
TestCombo will be one of 10 options depending on the data in TestType & TestReason.

examples: (here is an example of how the combo field will be populated. There will be ten total rules like this. one for each possible text option in the combo box.)
If [TestType] is "DRUG" & [TestReason] is "PRE" or "RAND" or "PA" then [TestCombo] would be "DOTDT".

If [TestType] is "ALCOHOL" & [TestReason] is "PRE" or "RAND" or "PA" then [TestCombo] would be "DOTAT".

If [TestType] is "DRUG" & [TestReason] is "N-PRE" or "N-OTHER" or "N-FUP" then [TestCombo] would be "NDDT".

The data does not need to be saved anywhere at all in the database, just generated when pulling this query. It will then be exported and dumped into another system.

Thanks. Here is a temp copy of the database with some junk data to maybe make it a little more clear.

View 9 Replies View Related

Modules & VBA :: Show Hidden Tabs Based On List Box Column Value

Mar 30, 2015

I am designing a contact database for a diocese and the contacts record form is divided into several tabs, some of which are hidden by default. One of the controls on the form is a listbox (lboRoles), where a user can add one or more roles to contacts. The listbox has a hidden column that defines the TabIndex for the assigned role, and my goal is to make the associated tab on the form that was previously hidden, to now be visible.

For example, if a contact is assigned the role "Committee Member" and the tabindex value for that role is 3, the form should make the hidden tab (where the page index is also 3) now visible.

View 13 Replies View Related

Modules & VBA :: Label To Display Total Of Column In Table Based On Two Checks

Jul 8, 2013

I am looking to generate a total number of a given column based on two criteria.I would like a label (or textbox if necessary) to display a given total of "Active" devices based on a given month.The table name is "Blackberry" and the specific columns I would like to check would be "Activated?" and "Registration Date". I'm not sure if I should be using a dsum or dcount and the error i keep getting is a type mismatch.an active device would have the text value of "Yes.

Dim advalue As Integer
advalue = DCount("[Activated?]", "Blackberry", "[Activated?]=yes" And "[Registration Date] > #01/01/2000#")
lblad.Caption = advalue

View 5 Replies View Related

Comparing Data In One Column To Another Column

Jun 20, 2006

I have two separate columns in my query but they contain the same kind of data. These two columns data should match but some of the data doesn't. Can I write a criteria that will show me only the rows that do not match.

DUTYPOSC
11B111B1
11B111B1
11C111B1
11B111B1
92Y111B1
11B111B1
13F121B1
For example, I want the query to show me only the rows in which the data in the Duty column doesn't match the POSC column.

View 1 Replies View Related

Queries :: IIF Statement Expression - Create Alias Column Based On Data From Two Fields

Jun 20, 2013

I am writing a very complex 'if statement' query expression. I need to create an alias column based on data from two data fields.

Here's the logic:

True: If [PP] = "WG" or "WS" or "WL" and If [GR] > 10 Then "Skilled" or
[GR] Between 6-9 Then "Semi - Skilled" or [GR] <6 Then "Unskilled"

False: "GS"

View 2 Replies View Related

Selecting The Right Column To Input

Jan 27, 2006

I have a combo box which I pull values from a table which has 2 columns. When I pull down the menu, both columns show but I want the 2nd column to fill out the field. Not the 1st column (which it is doing by default)

How do I fix this? Thanks.

View 7 Replies View Related

Table Column Format / Input Mask?

Nov 21, 2012

I have problem loading data from an excel file in to a table. I usually import the excel file in to a table via VBA script (because there are some changes I need to do before importing).It was working fine until this week when the data in a cell for a particular column in the excel file changed from being 3 letters to 4 letters. The column in the table is defined as text.

The data in this column usually looks like 001, 002, 003 etc but one of the cells in the excel file has data as P001.So now I get an error Runtime Error 3349 even though I have defined the column as text. When I change the data P001 to 004 similar to the other data, it works just fine. Is there a format or Input Mask I can set so that the data are correctly loaded in to the table?Or am I missing something?

View 7 Replies View Related

Reports :: How To Count A String In A Column And Print It In A Report

Oct 3, 2013

I am migrating a database from Spreadsheets to Access 2010. Everything else is going well but I am stuck at one point. A table has Name, Gender, and Nationality fields. Now, I need a report that will have only Nationality and Gender fields. The nationalities will be in a list and another column should have total count for each nationality. Then, the Grand total should be print at the bottom of the report. Moreover, two other columns should have a count of each gender (male and female) against every nationality.I need Report which will have Four columns i.e. Nationalities, Total, Male, Female... The nationalities column will contain a list of nationalities that are there in the data table [field name: National].. The total column will count and show the sum of each nationality from the data table [same field: national]... The Male and Female columns will do the same i.e. count the occurrence and show the total for Male and Female from the data table.

View 6 Replies View Related

Modules & VBA :: Update Column In Table Based On Another Table

Apr 24, 2015

I'm trying to use VBA to update a new column in a table with info I already have in another table.The table I want to update is an inventory details table, it has around 25,000 records. I added a column called "UnitCost", of course the column is empty for all 25,000 records so I would like to fill it easily using DoCmd.RunSQL "UPDATE" feature.

I use that through-out the program however I'm unable to connect the dots for this one.What it needs to do is update "UnitCost" in "InventoryDetails" from "Products" where "InventoryDetails.ProductNumber" = "Products.ProductNumber"

The "Products" table has all the different unit cost, it just need to be placed in the "InventoryDetails" table for every record. Of course product1 needs products1 unit cost and product2 needs products2 unit cost, etc.

View 1 Replies View Related

Forms :: List Boxes - Single Column Versus Multi Column

Apr 3, 2013

How do I select the first column of a multi-column list box (called "List1") for a query.

A single column list box works fine.

Code:

SELECT Tble_Employee.Emp_No, [forms]![attendee_form]![list1] AS SelectedCourse
FROM Tble_Employee;

View 6 Replies View Related







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