General :: Loop Through Query For Information

Jun 18, 2014

I am using Access 2010. I have a database that on a form uses a multiselect listbox. That part works just fine. The list box is for selecting additional people to email. Now I have had no luck with returning just the email address that are in a hidden column (the persons actual name is seen and "selected"). The names come from a separate table and is used as a forgien key. On that same table are the indivuals email addresses. What I did was loop through to get all of the ID numbers I am getting from the list box (the ID numbers are stored in the table that the form is based on).

Once I have all of the ID Numbers I thought that maybe there was a way to retrieve all of the email address associated with the ID Numbers. This is what I have so far. I know that AllQuery returns the first email address from the list box. I just have no idea if the query is returning more than one record, or if it is how to then go to the next record. I have tried a few things with little to no success.

Code:
Dim ListItem As Variant
Dim AllItems As String
Dim AllQuery As String
For Each ListItem In Me.EmailAdditionEgineers.ItemsSelected
AllItems = AllItems & Me.EmailAdditionEgineers.ItemData(ListItem) & " or "
Next ListItem
AllItems = Left(AllItems, Len(AllItems) - 3)
AllQuery = DLookup("EmailAddress", "AdditionalEmailRequestQuery", "[ID] = " & AllItems) & ";"

View Replies


ADVERTISEMENT

Forms :: Loop For Getting Information From Query Not Working

Sep 17, 2014

I am working on setting up a loop that will get information from a query. I can handle the rest of the code once I get the primary piece of information. Which at this point I can not get. I am trying to get to the next record of my query. For some reason I am stuck on just the first record and it is repeated the exact number of times equal to the number of records in the query. Here is what I have so far.

Code:
Dim FSO As Object
Dim FromPath As String
Dim FromPathCheck As String
Dim ToPath As String
Dim FinalDestination As String

[Code]....

Yes I do know that I am doubled up on the

Code:
rs.MoveNext

The reason is because with out this added rs it goes into an infinite loop. Need generating each value in the TRNumber field in the query.

View 7 Replies View Related

Modules & VBA :: Survey Form - Loop To Get Information

Sep 5, 2014

We have a survey form we are trying to get some information from, and I think I need a loop to get the information, but there isn't a ton of information that I have found for what I need to do.

I have a six question survey that has a range of answers and a comments section (I didn't write the survey):

1. Excellent, Okay, Poor, Very Good, Very Poor
2. Agree, Disagree, Neutral, Strongly Agree, Strongly Disagree
3. Agree, Disagree, Neutral, Strongly Agree, Strongly Disagree
4. Agree, Disagree, Neutral, Strongly Agree, Strongly Disagree
5. Agree, Disagree, Neutral, Strongly Agree, Strongly Disagree
6. Agree, Disagree, Neutral, Strongly Agree, Strongly Disagree

I have a simple query that will separate out the overall Positive and Negative reviews. The overall "Positive" or "Negative" ranking is manually assigned via a combo box on a form from a value list. Poor comments in the comments field can equate to a negative survey, even if questions 1-6 are neutral or better (good, very good, etc.)

What we would like to do is to poll through the responses to the survey and see how many of question 1-6 are consistently receiving Neutral or lower marks.

In my head, it makes sense to count through all the surveys and get a number of those responses. The response table (tblResponses) is setup with a combo box from a look up table that has the above responses. Actually, there are two lookup tables for this...one for question one, and one for questions two - six.

View 2 Replies View Related

General :: Grouping Records - Query To Gather Information From Tables

Mar 7, 2013

I have a query that gathers information from the tables in my database and returns something like this:

Code:
Field Pest
1 Insect1
1 Insect2
1 Insect3
2 Insect1
2 Insect3
2 Insect4

Field and Pest are fields in two separate (but joined) tables. Field exists only once in its table, and multiple pests are attributed to each field. I'm looking to create a table or query in which the values would be listed as follows:

Code:
Field Pest
1 Insect1, Insect2, Insect3
2 Insect1, Insect3, Insect4

The purpose for this is to create a legend for a map used by another program based on the information gathered in the database. I do have other criteria for which fields and pests show up in this query.

View 11 Replies View Related

General :: Loop Function With Variable

Jun 4, 2015

I want to make a loop like this:

Dim var1 As Variant, var2 As Variant, var3 As Variant, var4 As Variant
DIm var5 As Variant, var6 As Variant, var7 As Variant, var8 As Variant
Dim var9 As Variant, var10 As Variant
Dim i1 As Long
i1 = 1
Do Until i1 > 10
var & i1 ??? = "0" & i1 & "." & txt1 & "." & txt2
i1 = i1 + 1
Loop

How to make concatenate var + i1 to make loop function?

View 10 Replies View Related

General :: Loop - From One Continuous Subform To Another

May 21, 2014

I have attached an image of what i am trying to achieve so here goes:

I need to add data from one subform to another - problem is they are both continuous forms and both subforms.

The part in green is where it needs to go, and the white is where the data is held. The links have already been created, i just need to get the info from subform 1 to subform 2.

I have attached code but it only moves line selected / first line.

Dim dst As DAO.Recordset
Set dst = Me.frmAS9102_Material_LINK.Form.RecordsetClone
With dst
.MoveFirst
Do While Not .EOF

[Code] .....

View 4 Replies View Related

General :: Loop Through Listbox Records

Feb 15, 2014

I am looking to loop through all of the rows in a listbox. For each row in the listbox, I want to check if the last name in the Labor column is contained in any records in the Labor column of a recordset. If it is contained, add the column value to a variable to eventually be shown in another listbox. It seems that the loop is not working correctly and the EstHours is always 0 and the instr function doesn't seem to be working.

Code:
Sub ScheduledHours()
'on error goto errorhandler
Dim LastName As String
Dim FullName As Variant
Dim EstHours As Long

[Code] ......

View 3 Replies View Related

General :: Loop Through Resordset - Download Each Of Records One At A Time

Apr 14, 2014

I'm trying to 'Loop' through a recordset (i.e. "newRS") that has 46 records in it. I get the recordset as follows:

Code:

set newRS = currentdb.openrecordset ("PO Table")
newRS.movefirst

I want to download each of the records, one at a time, into Excel. To do this, I'm use the following:

Do until newRS.EOF = True

Several intermediate steps within the loop that aren't relevant to my problem

Set mySheet = myWB.Worksheets("db POLabel")
mySheet.Range("A2").CopyFromRecordset newRS
newRS.Movenext
Loop

Right after the 'Copyrecordset' command executes, the recordset cursor seems to be jumping to the end of the recordset and I get the following error message (when the code tries to execute the 'Movenext'):

'Run-time error: 3021: No current record'

View 2 Replies View Related

Some General Information Needed Please

Jul 2, 2007

Hi I am in the process of designing a new database using Access 2003 for my company. I have very little knowledge of access and what knowledge I do have is self taught!

The database is to hold medical records about patients that we see (we run a small medical centre)

The information that we put on it will include the patients personal details (name address etc..) and also details about treatments given to them.

Could anyone give me some advice on what type of database sounds best for this type of information. At the moment the database will only be used in the medical centre but will be accessed by more than one person at a time (not sure if that is relevant !

I really would appriciate some advice as some of you guys have helped me before and i value your opinions.

Many thanks in advance

Paul :)

View 11 Replies View Related

General :: Where / How To Store Reference Information

Nov 12, 2013

I have not developed a database application before. At my work I was seconded to fill in as a team lead for a change management team. We are in a production environment and need to track the progress of product improvements. The current system is very complicated using an enormous Excel spreadsheet and a very bid MSProject schedule. It is very handraulic in the way it is maintained.

Before I started I reviewed who inputs data, who uses the data, and what metrics are reported. I can reduce the amount of data that is recorded by only generating many of the existing Excel fields through calculation run when a report is generated or a chart populated.

I need to track the state of several hundred minor changes through the production run. The reference data I need to store is serial number against production batch. This is fixed data that is not changed, only used as to show the entry point of a change into the production line and which serial numbers the change is applied to.

View 3 Replies View Related

General :: Grabbing Web Information Into Database?

May 17, 2015

I have two third-party library programs that allow you to type in an ISBN and the software searches, say Amazon, and grabs particular missing data: author, cover jpg and summary etc, and imports the info to the program. I'd like to replicate this process with Access. If I can type in an author, title or ISBN to Access, I'd like it to search Amazon to gather and input the missing data to my assigned fields. Is this possible? Or am I stuck to typing in the information separately.

View 10 Replies View Related

General :: Form Not Displaying Information

Dec 11, 2012

I a a new user to Access having only every ceate a couple of small databases using the wizards. I have just started a database where I have created my tables and I am now creating a form to display information. The problem that I am having is that when in Design mode I can see all the information and fields that I have used to create the form, however when i save the form then opening in display mode I do not see any of the fields, revert back to design mode and hey are all there.

View 14 Replies View Related

General :: Reading DB File Information?

Sep 29, 2013

I see a lot of requests for this operation, but apparently .DB files are so general that sometimes it's impossible? Any all-encompassing program that can read files like this? I believe they come in different formats and are produced by a variety of different programs. The only thing I ever see though are files with [.db] as the extension.

If I open the one I have with notepad on a windows machine I see some of the info but some of it is not there and is garbled.

[URL]....

View 4 Replies View Related

General :: Saving Information From Form To A Different Table?

Nov 26, 2012

I have created a form and a subform within it, I have managed to populate all the dropdown boxes from the tables I need. but I need to save all the information in putted to a table called bookingstbl and I do not know where to begin?

View 6 Replies View Related

General :: Cannot See Where To Enter Emergency Contact Information

Sep 17, 2012

I downloaded a student template from microsoft and have been able to figure out most of it. I cannot see where to enter the emergency contact information. Also, when I try to see the student and guardian table/list, the guardian list comes up empty even though I entered this information when I entered the student info...

View 2 Replies View Related

General :: Automatically Add Information After Field Exceeds?

Sep 20, 2012

I have a field "Permit_Date_Expired" field automatically is created by adding one year to the "Permit_Date_Issued" field.

when the "Permit_Date_Expired" field exceeds TODAYS() date I want it to automatically change the field "Permit_Holder" to say Expired is this possible?

View 5 Replies View Related

General :: Collecting 2 Types Of Information From Combo Box

Mar 6, 2014

I have 2 tables

1. stocklist
2 product details

I created a form called " product details "

Using a combo box in the form "product details" I select a "part number " of which the part number and the associated description of the part comes into a fields called "part number " and "part description "

The part number selected then goes into a table called product details

Is it possible that when I select the part number , both the part number and the part description go into the table called product details.

View 1 Replies View Related

General :: Get Some Information To Show Up In Chronological Order?

Jul 17, 2015

how to get some information to show up in chronological order.

For example,
It is showing up like this..

Week 1
Week 10
Week 2
Week 20
Week 3
Week 4
and so on

I want it like week 1
week 2
week 3
week 4
week 10
week 20

View 8 Replies View Related

General :: Adding Two Numbers While Inputting The Information?

Apr 1, 2014

I have a database where on the form we are just put in total deductions. We want to make sure that the total deductions is correct so while we are entering this number we want to do an excel thing by hitting = 1 + 1. Anytime we do that we are getting an error message. I really didn't want to have to set up a table to store these different amounts because we really only need the total. Is there a way to do that? I changed the format from currency to general but I'm still getting the error.

View 2 Replies View Related

General :: Get ID Number And Update Record With New Information

Jul 25, 2014

I am having a problem with retrieving the information I am looking for. Basically I am checking to see if a user has selected a TRNumber from a drop down menu and if that TRNumber matches any other records in the table in that field. If it does, is that Number already associated with the user selecting it. If it is I want to get the ID number so I can simply update the record with new information. Here is what I have so far.

Code:
Dim Rs As DAO.Recordset
Dim Tech As String
Dim MsgStr As String
Dim IdMod As String
Set Rs = CurrentDb.OpenRecordset("PrepStartDateBlankQuery")

[Code] .....

View 14 Replies View Related

General :: Using Recorsets - Loading Form With Information From Different Tables

Jul 8, 2014

I have tried on different forms using more than a few different methods to make recordsets happen and to no avail. My current reason for needing to use recordsets is because I am loading a form with information from different tables. Instead of using multiple DLookups, opening the recordset only looks for the information once, speeding up the load time on the form.

Code:
Dim Rs As Dao.Recordset
Set Rs = CurrentDb.OpenRecordset("PreviousTRRetrieval2Query")
If Rs.RecordCount > 0 Then
ProjectNumber = Rs!ID
Agency = Rs!WitnessAgency
FileNumber = Rs!FileNumber

That is the start of my code and I keep getting an error, 3061 Too Few Parameters. Expected 1. Now when I run the query I get the results I desire, which is all the information I need at this particular junction. I am using Access 2010. Why I may not be returning any results for my recordset when the PreviousTRRetrival2Query returns results on its own.

View 12 Replies View Related

General :: Timestamp Information When Certain Field Changed By User

Feb 19, 2013

I have a form that i want to some how in a text box post a time stamp anytime information in a certain field is changed by another user.

The time stamp shows on the table only when the table is saved or imported.

Is there a vba code i can attach to a text box that will show me anytime an entry is made?

View 4 Replies View Related

Insert Query Loop??

Feb 20, 2006

Hi I am creating a stock database and I have come across this problem:

I have a stock table, and I have successfully creted a query to insert a record with values selected in a form:

EG. In the form you can input a part no, comments and the quantity you want to add. I have created the stock system so that each individual item of stock is one record in the stock table.

What I can't seem to do is use the quantity field in the form to dictate how many times the form details is entered into the stock table.??

HELP

View 1 Replies View Related

Queries :: Use A Loop In A Query?

Jul 17, 2014

I have a query that includes fields from T_employee and fields from T_courses, which is courses taught by each employee per semester and T_ Additional, which is additional hours added to employees for each semester. The query groups by employee and has a calculation of the teachers total hours per course based on teaching hours and factors for marking and preparation and adds the additional hours from T_additional.

Each teacher cannot have more than 44 hours, so there are additional calculations that calculate the consequence of subtracting one course from the total hours. The record that is closest to 44 without going over is optimal. In some cases, subtracting one course is not enough to get the hours below 44 and an additional course will need to be subtracted and perhaps a 3rd an so on.

I would like to evaluate which course is the most optimal to subtract and if it is not enough, then to loop through and subtract the next course until the hours are below 44, but as close to 44 as possible.Would a Do loop be what I need? I need to output the total number of hours that were subtracted and the number of courses.

I tried creating a query based on this one, grouping by employee and under the NetHours in the totals row, the max nethours <44. This works but there are still a few records where the nethours is >44. I would like to use a Where in the Totals row and in the Criteria somehow indicate that I want the largest number that is less than 44.

View 2 Replies View Related

General :: Recording Information In Form - Filling In New Fields Based On ID

Jul 26, 2012

I have a form to record student information. On my student table i have a school I.D that links to the primary key of my school table.

My problem is that in my form, i want to be able to fill in the rest of the fields about the school info based on the I.D chosen.

i.e.

student table:
Student id
name
address
school I.D (FK)

School info table:
School I.D (PK)
school name
contact name
email
address

My form that's linked to the student table needs all the information from the school info table in separate fields
but i can only select School I.D in the Control Source Property.

View 1 Replies View Related

Modules & VBA :: Run A Loop Through Each Record In Query?

Apr 30, 2015

Is it possible to run a loop through each record in query, but refresh the query in between loops?

The query I am looping needs to be updated before moving to the next record.

t can't figure out how to get the query to refresh before looping.

View 3 Replies View Related







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