Modules & VBA :: Pull Data From A Table That Meets Number Of Conditions?

Jul 3, 2014

I have a module that is in Excel that is connecting to a back end database. I am trying to pull data from a table that meets a number of conditions. With the following statement, it is not returning any records,even though I know there are records that meet all of the conditions. I suspect the problem is with the last condition. In that condition I am trying to say that pull in records where it has been at least 14 days since the last review.

Code:
strSQL = "SELECT tblsojrol_oc.* FROM tblsojrol_oc WHERE tblsojrol_oc.[Status] = 'Pending' AND tblsojrol_oc.[1st Review Date] IS NOT NULL AND " _
& "tblsojrol_oc.[3rd Review Date] IS NULL AND (DateADD(Day,14,tblsojrol_oc.[2nd Review Date])) >= #" & dt & "#;"
objRs.Open strSQL, objConn, adLockReadOnly

View Replies


ADVERTISEMENT

Modules & VBA :: Pull Data From Query (or Table)

May 4, 2015

I have a table that has four columns. Column 1 had people's names, column 2 has their email, 3 has a category, and 4 has their office.

I have a form with radio buttons, When you check a radio button and press OK it will display the e-mails for the people selected. Problem comes when it's by category, since categories are not unique to one person. I want to click the category radio button and have it display every person under that category, concatenated with a comma.

Problem is I can't make a listbox because it will show the same categories several times instead of just once, so I want the radio button with the category name on its label, and then in the code I need to tell Access to go to the table and search for the e-mails from a specified criteria, the category.

How do I do this?

View 1 Replies View Related

Modules & VBA :: Code To Add Data In The Listbox That Meets Certain Criteria?

Jul 17, 2014

I have a Access table that stores BatchNo,Scandate,NewBatchNo . As I can't attach Access database here so I have exported data from Access to Excel in Sheet1 to show how the data is stored in Access table.

Now I have to write code in VBA that will check the last NewBatchNo in the table . In the attached workbook its 194389. Now vba code should check the NewBatchNo which are blank before 194389 . Now in the records where NewBatchNo is blank , it should add the corresponding BatchNo,ScanDate in the listbox1 in form1.

e.g Sheet2 in the attached workbook stores Bathcno and Scandate of those records where NewBatchNo is null and before the Last used NewBatchNo which is 194389 in our example.

View 4 Replies View Related

Modules & VBA :: Updating Dynamic Combobox - Pull Data From Table

Oct 31, 2013

Right now I have a subform with a combobox that pulls it's data from a table. I want the user to either select an existing item or type in a new item and have a macro create the new table row. What I have right now works in the sense that it prompts the user if they want to creat a new item and the new item is created (and I can see it in the combobox list), but I'm still getting an error saying that the item does not exist in the table forcing the user to manually select the newly created list item they just typed in.

Code:
Private Sub MaterialCostCode_NotInList(NewData As String, Response As Integer)
Dim rst As DAO.Recordset
'Update value list with user input.
On Error GoTo ErrHandler
Dim bytUpdate As Byte

[Code] ....

It appears that the new item doesn't always show up automatically and requires the form to be refreshed, so now I need to figure out how to get it to consistently appear right away without a refresh.

View 3 Replies View Related

Modules & VBA :: Pull X Number Of Records From A Database

Jan 23, 2015

I need to first generate a random number between 1-4.

Then I would like to use that number to pull that many records out of the database; the records pulled can be random, or whatever.

For example, we have 4 people and my goal is to choose a random # of records to pull for each person. So, for person #1, it might only pull 1 record, then for person #3, it may pull 2 records, etc.

Ideally, it wouldn't pull the same # twice when run for that "session".

After this, I'm hoping to generate all those results into emails (eg for person 3 it would generate 3 emails, etc)

Currently it's all done manually and I think it's doable with Access.

I have some code already for generating "1" email message, but do not know how to pull X number of emails all at once. (X is the random #).

View 2 Replies View Related

General :: Pull Data From SQL Server Based Off Of Order Number?

May 27, 2015

I am looking into re-creating something I have created in Microsoft Excel into Microsoft Access.What I do in the Excel spreadsheet, is when I type in an order number, various fields in the spreadsheet are populated using vlookups and ODBC's.

I wish to re-create this in Access but not sure how. I have a basic form, with various fields such as, order number, part number, description, quantity.What I have in my mind is that I would like to be able to type in an order number, then the rest of the fields would be populated by a query to a SQL Server database.i can see a way to do this using VBA but would rather look for a more direct way if possible.

View 2 Replies View Related

Queries :: Pull Invoice Number From Another Table?

Oct 22, 2013

I have 3 tables invoice, customer and items. I need to create a query that will get the next invoice number from the invoice table and mark that invoice number in the items table for a set customer where the invoice field in the items table is blank.

The invoice table is now set up as a autonumber, therefore I need to append to get the last new number.

The items in the item table are unique and this is why I want to mark the invoice number in the item table field invoice.

View 1 Replies View Related

General :: Transferring Data From Table To Another Under Conditions

Feb 22, 2013

I have 3 tables :

table 1 empno Employee Nomber
empname Employee name
salary basic Salary
bonus
deduction
iddate month nomber

table 2 is bonus table id
empno
bonus amount
iddate

table 3 is deduction tableid
empno
deduction amount
iddate

Now i need is to transfer the data from bonus table and from deduction table to the table 1 if the empno and iddate are equal on the both tables

What I mean for ex if i create query and when i enter the employee number directly it will give me his bonus if he has and his deduction also if he has, so how can i do it?

View 1 Replies View Related

Modules & VBA :: Using Combo Box To Pull Data Using (Like)

Jul 17, 2015

What I want the form to do is filter on a column where I have combined 3 columns of actives together. So the form will filter if one of those values is any of those three columns. So I have a macro setup right now trying to filter for anything "Like" what has been selected in the combo box. Here is what I have in the where condition of the filter macro:

Code:

((([Active1] & " " & [Active2] & " " & [Active3]) Like "*" & "[me.cboactives]" & "*"))="'" & [Screen].[ActiveControl] & "'"

This is in Access 2013

View 2 Replies View Related

Modules & VBA :: Automatically Repeat Last Record Under Certain Conditions In A Table / Query

Jul 15, 2014

I’d like to repeat the last not = 0 record under certain conditions, in a table or in a query.What I have:

Calendar_All Dates
Calendar dateMyValue
7/6/20140.00
7/7/2014108.94
7/8/2014107.71

[code]...

Basically, if Calendar date > Date(), if Calendar Date not Saturday or Sunday, weekday(Calendar date<>1 and <>7), AND Calendar Date not in (Holidays table).Then repeat the last not = 0 value of MyValue. I thought of changing the default value but the value is already 0, while default is null + I need to set the default value under certain conditions.

View 14 Replies View Related

Pull Data From Another Table?

Jul 27, 2006

I have a table that contains the following:

Code BrandName Lead Free Nickel Free
001 AAAA Yes Yes
002 AAAA Yes No

On a form the user selects the code field and in this table the field is called BRAND. On the same form, I need to display the value in the Nickel Free field so if selects 001, the field on the form needs to be "Yes", if the user selects "002", the value needs to be "No"

View 1 Replies View Related

Modules & VBA :: Search And Pull Data From Db Stored In A Shared Path

Dec 30, 2014

I have two different database files. One is 2010 ".accdb" format where I have created a form and the inputs to the form is getting saved as records to an access.mdb file in a shared path.Now if the users want to edit the existing record I should allow them to search their previously submitted record with a unique ID number.

I know it is possible when we have both the form and table in the same db. But I want to know whether it is possible to search with a unique ID and pull the data from different db in a shared path using a command button?

View 5 Replies View Related

General :: Automatically Delete Data That Meets Criteria?

Mar 15, 2013

I'm an amateur (is there such a thing as having databases as a hobby?) with little training. I volunteered to organize a growing volunteer group I'm a part of by making a simple database for the volunteer office staff. One of the things I want it to do is make name tags for our weekly meetings. I don't want to print one for each name on our list because the list is over 400 names long with only around 35 regular attendees. I made two tables--one is the MakeNameTag table that lists regular attendees (it is a lookup field on the Names table).

The other is the Absences table. It has two fields; DateOfAbsence and MakeNameTag. If someone misses a meeting (does not pick up their name tag), their name is added to the Absences table. A query then filters the table for dates in the last 28 days. If their names shows up four times in the last 28 days I want for their name to be deleted from the MakeNameTag table. How to do that automatically? Our office volunteers have minimal PC skills, so the solution needs to be very user-friendly.

View 3 Replies View Related

Would Like Field To Automatically Pull Data From Other Table

Apr 28, 2006

Hello Everyone,

I am having trouble with our receiving database. This database consists of two tables. One for vendors, which basically contains their vendor ID as well as vendor name and phone # etc. The other table is our receiving data table. When our receiving person receives product in, they log this in the receiving table including info such as date, autonumber for record, vendor etc. The problem is, when the person selects the vendor id, which is set up as a lookup field, we would like to have the vendor name pop up atuomatically within that record. I cannot for the life of me figure out why this isn't happening. The person is using a form to enter all of this data and runs a summary report at the end of the day. Our accounting dept. is requesting this info be added, but I cannot seem to figure it out.
Thanks so much for any assistance!
Amy (monet1369);)

View 6 Replies View Related

Search To 'pull' Data From Diff Table?

Mar 29, 2006

v sorry for the basic question, but ive been banging away at access and i cant my head around this..

i need to run a simple query. the query/ search will ask users to enter in the number of a document. i want, when this code is entered, for 2 controls on the form be updated with codes that are stored in a table based on the code they searched for originally.

heres my table structure...
Table A
Doc ID (PK)
Doc No (manually input and is the search item that users enter)

Table B
Unique ID (PK)
Doc No (FK)
Info (to populate field 1)
Info (to populate field 2)

how do i perform this in the query section? do i need to manually code the SQL required, or is this query basic enough that i can just select the fields required in the design view of the query?

thanks guys

View 1 Replies View Related

Forms :: VBA Code To Pull Data From Different Table?

Mar 26, 2015

I have a form I use for data entry, it needs to generate an id called RO Number and i need it be generated by access starting at number RO129036 and then keep adding sequentially, so RO129037 etc etc.

as i already have data in my DB that i need i cannot just reset any fields

having a table with just one field - the numeric part of the RO number so first one would be 129036 - so i need the form to pull this field, add 1, and then add "RO" at the beginning of it? i have really been struggling with this database

View 3 Replies View Related

General :: How To Pull Data From One Table And Store It In Another

Nov 10, 2013

I am trying to add an attendance records to my database but cannot figure out how best to do it..I already have a 'children' table were all the kids info is stored and have created a 'roll' table.

i want to be able to open a form and search first and/or last name from the 'Children' table, then be able to save both first and last names and the date into the 'Roll' table. (then open reports etc later based on dates)how to pull data from one table and store it in another.

View 3 Replies View Related

Queries :: Using Criteria To Pull Data From Specific Table

Sep 16, 2013

Is it possible to have a query that uses criteria to pull data from a specific table?

For example: IIf([Result]'"Negative",(tblNegative goes here),IIf([Result]="Positive",(tblPositive goes here].

The tables are just text, but the query would be too long if it was used.

View 2 Replies View Related

Form Field To Auto Pull Data From A Table When There Is A Match

Feb 5, 2013

I have built a nice database that has a form to enter data which logs in product received, there is a combo box on the same form that is linked through the query builder to auto populate the names from the contacts info table (the receivers of the product received) the contacts info table also contains information that is specific to each name such as locations.

As of now I have created a command button that brings me to the form that shows the information fields I need specific to a name, once I get that I have another command button to bring me back to the main form. How to create an additional list box on the main data entry form so as when the name is entered the new list box or text box (which is best?) will auto populate the information I need on one form instead of going back and forth.

Example:

Requester Name [ auto populate name ] currently linked to contacts info table (working)

(New field) Preferred Location [ need to auto populate location ] from the contacts info table (how do you pull locations specific to a contact name from the same table?

View 3 Replies View Related

Modules & VBA :: Check Policy Number In Access Table And Populate Related Data In Excel Sheet

Aug 14, 2014

See attached the Workbook. I need to check the policy Numbers in Column A of all the sheets in the attached workbook if its present in Access Table. If yes then write the corresponding ScanDate and BatchNo from Access table to columns I and J of all the sheets. I need to write VBA code to perform it.

In the attached workook, only Sheet1 contains the data but in actual there will be data in 5 sheets in the workbook.

View 1 Replies View Related

Reports :: Button To Pull ID Number Of Record?

Aug 28, 2013

I built a report that provides all of the open support tickets. My idea is to have a button (Which I called "WorkIssue_Button") that displays beside each record that is populated on the report... I need this button to be able to pull the ID number of the record (Called "ID"). I then plan on opening a form that is preloaded to this record. How to pull that information?

View 5 Replies View Related

Modules & VBA :: How To Do Multiple Conditions

Nov 6, 2013

how to do multiple conditions, Nested....I have 6 conditions that i like to check,

Code:
if (condition-1) And
(condition-2) And
(condition-3) And

'[code]....

View 8 Replies View Related

Modules & VBA :: IF / Then With Multiple Conditions

Sep 10, 2014

I'm trying to create an If/Then statement that needs to match to multiple values. My initial thoughts were to create a list but that doesn't seem to work the way I thought it would.

For example:
If Me.Field = 1,2,5, or 8 Then
Do 'X'
Else IF Me.Field = 3,4,6 or 7 THen
Do 'Y'
Else Do 'Z'

I haven't been able to get the syntax to work right. I'd rather not have to do 'Me.Field = 1 or Me.Field = 2, etc.' but if that's the only way to have it work right, then I guess it'll have to do.

View 6 Replies View Related

Modules & VBA :: Multiple Conditions In A DoCmd

Oct 11, 2013

I have a Customer Issue form that writes the following into one table named Table1: Date, Customer Name, Ticket number, Agent, Issue and Comments. This is very simple.

All of this is filled in from a form that has links to 3 other tables for drop downs; Customer Name, Agents, Issues. This is working perfectly.

What I want to be able to do is generate a report based on a date range for a particular agent. Say 9/1/2013 - 9/30/2013 for John Doe.

For the report portion, on the form I have to combo boxes, one for start date, one for end date. I also have a drop down for selecting the agent. When I click a button on the form named Report, It will generate a preview of the report.

Here is the problem. I can get this to generate a report based either on the date range, which gives me all of the agents, or by agent, which gives me all of the dates. I can't get it to do both.

Here is some code that I have on the Report button:

DoCmd.OpenReport "AIReport3", acViewPreview, , "[Agent]=" & Me.Agent
This is the code that will let me choose the agent, but gives me all dates.

If I change this code to this:
DoCmd.OpenReport "AIReport3", acViewPreview, , "[DateRptd] Between #" & Me.cboFrom & "# And #" & Me.cboTo & "#"
It will display all issues in the date range, but gives me all agents.

I was thinking I should be able to combine them with an AND or an & to get it to use both the agent and date fields, but I can't get this to work.

Something like: DoCmd.OpenReport "AIReport3", acViewPreview, , "[Agent]=" & Me.Agent And "[DateRptd] Between #" & Me.cboFrom & "# And #" & Me.cboTo & "#"

or

DoCmd.OpenReport "AIReport3", acViewPreview, , "[Agent]=" & Me.Agent & "[DateRptd] Between #" & Me.cboFrom & "# And #" & Me.cboTo & "#"

View 3 Replies View Related

Compare Data In Two Tables, With Multiple Conditions…..

Aug 25, 2005

Been trying to crack this one for a while hoping someone on here might be able to help me. ;)

I have a table with a list of required software and a table with a list of computers and the software installed software. I made a query that displays the machines with the required installed. My problem is if a machine has more than required then it does not display the record. If it needs Office, Photoshop but has office, Photoshop and quark installed then it does not display that machine.

This should be quite a simple thing, I have played with Like, NOT, Where and others but with no luck...

Any help would be greatly appreciated.

Graeme

View 2 Replies View Related

Modules & VBA :: Prevent Deletion Or Changes To Records That Meet Certain Conditions

Jun 14, 2013

Been experimenting on some code to prevent deletion or changes to records that meet certain conditions.

The problem I am having is the code is contradicting each other preventing some of the records to be locked down.

Code:
Private Sub Form_Current()
'Code 1 - Prevent edits if 21 day period has lapsed
If TestDate2(Me.txtStartedHidden) > 0 Then
MsgBox "Editing NOT allowed - 21 day time period has been reached"
Me.txtBasic.Locked = True

[Code] ....

Rules are:

Edits allowed if invoice date not reached
Edits allowed if within 21 day but NOT if invoice date is reached

Edits prevented if invoiced date reached and if records still within 21 days
Edits prevented if invoiced date reached & records past 21 days

View 2 Replies View Related







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