Selecting Records Through A Form For A Query
Jul 13, 2006
I have a problem I should be able to solve, but I can't think my way around it.
I need to automate a series of tasks to perform the following:
1. The user clicks a button on a menu form and arrive at a select records form.
2. The user makes choices regarding the contents of certain fields (blank, not blank, equals a text string, etc.) and presses OK.
3. On the OK click, the fields are applied to a query, the results of which are exported in an excel spreadsheet.
I've been doing step 2 and 3 by hand in that I alter the selections in the design view of the query and save it. I then run a macro that deletes the data in the current table, runs the append query with the new criteria, and creates an excel spreadsheet of the new data.
However, I now have to make this functionality available to a non-tech person, thus the need to create a GUI menu that can launch a form on which the user can select options and with a single click, launch the macro.
I've tried adapting select forms that I've used with forms and reports using the doCmd.openquery, but they will only work for select or crosstabs, not appends. I considered having the form create the query and then qrite the append query off that, but I can't seem to get that to work.
Can anyone give me some direction on where I can take this?
Thanks.
Susan
View Replies
ADVERTISEMENT
Oct 31, 2014
I have a query pulling data from two other queries (qry_Reports and qry_Surveys). Clients may have more than one ReportID, but only one ClientID. I need to query for only the most current ReportID (which is the larger value) for each client to find the surveys for the most recent report. How can I query for only the most recent report for each client based on the highest value of the ReportID per ClientID?
View 11 Replies
View Related
Nov 13, 2011
I created a subform that displays the records of a select query after selecting the desired data from a single combo box (for instructors name) and then using an OpenQuery macro attached to a button.
Only 1 record is displayed in the subform each time I hit the button. If I look at the query return there is no change. However, if I close the query and select a new instructors name, although I only get one record in the subform, the query when opened shows all the correct records.
What is wrong with my macro/subform?
View 8 Replies
View Related
Dec 12, 2006
Folks,
can someone help me on this? I am not sure why the select query inside this procedure is not working. Here is the that routine:
Public Sub temp()
Dim strDocName As String
Dim strTableName As String
Dim strTbl As String
Dim aot As Access.AccessObject
Dim strSQL As String
Dim rpt As Report
Set rpt = CreateReport
strTbl = Forms!frmSearchBoilerGuar!cboTypeOfGuar
For Each aot In CurrentData.AllTables
If aot.Name = "strTbl" Then
strTableName = strTbl
End If
Next aot
strSQL = "SELECT tblProjts1.chrProjectName, tblProjts1.chrBlrPropNum, " & _
"strTablename.memGuranItem , strTableName.memLDs FROM tblProjts1 " & _
"FROM tblProjts1 LEFT JOIN strTableName ON" & _
"tblProjts1.intProjectId = strTableName.intProjectId"
rpt.RecordSource = strSQL
strDocName = "rpt"
DoCmd.OpenReport strDocName, acPreview
End Sub
Basically, I am trying to select a table name from the combobox and then use that table name for my query. Then I want to use that query as a recordsource for my report.
Any help is greatly apprecited.
Shan.
View 2 Replies
View Related
Apr 10, 2006
Hi,
I have a query that gives an out put of 'worst offenders'. these offenders are in order of on field ascending (number of entries made per week) and another field descending (total sales).
It is by the combination of the sorting of these fields that we have an ordered list of offenders.
For my report i want to only see the top 10 records of this sorted list.
so for this selection i simply want to select the [B]first 10 records [B]of the ordered list. I cant make a selection by any one particular field(as explained above)
i have looked into the 'select top' functions and 'dfirst', but I dont think they'll work for me.
Any ideas?
Slighlty confused,
Rosxx
View 3 Replies
View Related
Jun 11, 2007
hey guys, im having one last problem with a report im making. just want to thank boblarson, Rich and Dennisk for all the help they have given me upto now, i have added to your reputation guys, thanks!
My problem is as follows:
I have a form for my products and a subform for the suppliers, each product can have many suppliers.
I need to have a report of products to send out to customers, so i created a check box to "tick" if i want to include it in the report. So far so good, however, the report shows each product several times for each supplier :(
can anyone tell me how to select only the supplier with the lowest supplier price for each product
Cheers guys
View 9 Replies
View Related
Jul 30, 2006
Hope someone can help.
I am building a database to evaluate football team performance. I have a table with results (tblResults) where a team will have records in either the Home Team or Away Team fields depending on the fixture.
I want to include a "Team Form" calculation that selects the last 6 games for each team (both home & away) and allocates points to calculate a recent form stat for comparison with the opposition.
I have tried using the TOP VALUES option in a query, but I can't seem to get it to extract the top 6 in descending date order for every team.
Would be very grateful if someone could help!
View 3 Replies
View Related
May 18, 2007
I created a personal database for keeping track of my meeting schedules. My table has Date field, Time field and Subject field. I have made several entries. On a given day, I have several meetings at different times.
I created a combo box in my form to choose the Date and see that day’s meetings. The meetings list of the date chosen by combo box should appear in my form. But here I think I made a mistake. Each record has date, time and subject. When I click the combo box, the drop down list shows the same date many times (as I have entered the same date but different time and subject for each record). How do I make the combo box display the date only once and not same date several times? Do I have to change the table set up? Please guide me.
View 1 Replies
View Related
May 19, 2005
I have a database that allows the user to order clothing items.
Each size of each item has a different stock number.
I have [StockNo] - [StaffNo] - [Qty] i need to generate [OrderNo].
The problem i have is that [OrderNo] is incremented after every five five items (ie[StockNo]).
This gives me my first problem of selecting just the first five records of a table in order to allocate an order number.
The second problem i have is that in order to allocate an order number, i have to summarise the [Qty] by [StockNo].
This gives me the opportunity to select the order number but i lose the individual [StaffNo] information.
This information, together with the [OrderNo] is needed for a master order table.
I have created a crosstab query which summarised the [StockNo]but how do i retrieve the [StaffNo] information from the column headings.
I am new to Access and would be grateful for any help or comments as to whether i am going about solving this problem in the best way.
Thanks
View 1 Replies
View Related
Feb 16, 2005
Hi,
ok part of my database is made of 2 tables.
tblItems
item_id
maunfacturer_id
supplier_id
item_name
tblQuantities
quantity_id_num
item_id
quantity
(item_id linked)
ok so I want a form that has a combo box with [item_id, item_name] on each row that i select. when i select one it displays the relevant quantity and allows me to edit the quantity.
any ideas how i can do this?
Thanks:)
View 3 Replies
View Related
Sep 5, 2004
I'm trying to write an app that will allow the user to search for records based on database fields, then select a subset of those records to be manipulated by other functions. The VBA book I'm reading led me to believe that a RecordSet would be the best way to store this subset of records, but searching around on the web has pointed me toward using a DAO.QueryDef. I can't seem to get either method to work!
Here's a quick overview of the app: everything is placed on one form. I have two tab controls that make a sort of upper and lower set of pages. One of the lower pages has the search functions. The user enters his search criteria into one or more textboxes (correlating to database fields, i.e. Last Name, SSN, etc), then hits the Search button. This should query the database, then populate a listbox with the search results. The user can then select one or more records from the listbox, hit another button, and the selected records are copied to another listbox on a page on the upper half of the form, where they can be further manipulated.
Can someone advise me on the best objects to use to accomplish this? A short code sample would be awesome.
By the way, does VBA have some sort of online API reference (like Java)? I know that MS Access has the object browser, but it doesn't give descriptions of the objects, nor does it list methods that can be invoked on them. Could someone also point me towards some good programmer's resources?
Thanks...
View 2 Replies
View Related
Jul 30, 2012
I am using an unbound box on the top of a form where I would like to select a clients name and have the form populate with their info. My problem is that the box will pull up the record by last name, but only pull up the first record with that last name in alphabetical order.
Example, If I have the following names in my database
Ben Smith
John Smith
Tim Smith
If I select "john smith" from the drop down "ben smith" will show up, if I select "tim smith" "ben smith" will still show up. If I select "ben smith" the correct record would show up.
An image of the property sheet is attached ....
View 6 Replies
View Related
Feb 28, 2006
I tried the Crystal Reports forum, but no responses. Can anyone see what I'm doing wrong with the below statement in Crystal Reports 8.5. I'm
trying to select reecords that exceed 7 days based on a Crystal Reports parameter. The parameter has the format of 2/27/2006 (Discrete value). The 'LastRouteDate' has a format of 'datetime'. Thanks ! ! !
{?Select_Date} - DateValue({Applications.LastRouteDate}) > 7
View 2 Replies
View Related
Jul 12, 2007
I was wondering if someone could help me.
I have a simple table with data that gets updated daily. I need to split the data into 5 equal parts for work distribution. Because the amount of records always changes I can not go by numbering so I need to go by percentage, to split it into 5 ( 20% ) parts. Please help.
View 5 Replies
View Related
Nov 29, 2007
I have looked but have been unable to find the answer in past posts and this must be a common problem. I wish to include all records up to and including a date passed in the prompt "Criteria: <=[enter end date]". I changes the date format in the back end to short and I am in the US. However I get only dates less then the the prompted date.
Thanks for any help
Jim
View 10 Replies
View Related
Apr 2, 2006
Hi All,
Any ideas on how I do the following.
I have a table with 1500 records in it.
I want to select at random 4 of these records and append them into another table along with some other data that the query will not pick up, in this case Pilot and Month.
I guess I am having to go the VBA route but dont have a clue on how to do it.
Cheers in anticipation.
Andy.
INSERT INTO Assignments ( flightcode, aircraft, depart, destin, pilotcode, [Month] )
SELECT Schedule.Flightcode, Schedule.Aircraft, Schedule.Departure, Schedule.Destination, [pilot] AS Expr1, [MONTH] AS Expr2
FROM Schedule
WHERE (((Schedule.Departure) Like "man*"));
View 3 Replies
View Related
Jun 15, 2006
Is it possible to have a combo box on a form and allow users to select multiple entries from the drop-down list? Thats just the tip of the iceburg. If you can, then I'll probably be asking more questions soon.
Thanks in advance.
View 2 Replies
View Related
Jun 27, 2005
Hi,
I am trying, and getting nowhere...so would appreciate your help... to create a query where records with dates from 8 weeks, or two months ahead appear in the query.
That is I have contracts ending in two months in my table and I want to run a query on who I should call now to renew contracts.
I have a contract end date in table.
I have tried
>=DateAdd("m",2,Now())<=DateAdd("m",2,Now())
only to get all sorts?
>=DateAdd("d",60,Now())<=DateAdd("d",68,Now())
only to get all sorts of things appearing?
Anyone that could help would be great.
I have contact info in a TBLCONTACTS and linked to TBLMOBILES via COMPANY_ID
Thanks heaps!
C
View 2 Replies
View Related
Jul 10, 2007
hi,
i am querying a single table that contains card numbers and corresponding transaction codes (amongst other things). a single card number can have multiple transaction codes.
i want to select all card numbers that have both 0100 and 0802 transaction codes.
if i use a select query with ="0100" Or "0802"as the criteria, it returns all card numbers that have either 0100 or 0802 transaction types. if i then change the query to crosstab and group by card number, it is clear that some cards have both transaction types.
when i try to change the criteria to ="0100" And "0802" it returns nothing at all.
i'm sure the solution is something really simple - any idea what i'm doing wrong?
View 7 Replies
View Related
Sep 15, 2005
Ok sorry to be a pain :D
I have a main form frmProperty from where you can go via a button to frmTraining and these two are linked by "Property Code".
On frmTraining i have an unbound combobox which gets it data from the tblTraining table. I want this to only display data for the "Property Code" that the frmProperty is pointing to.
I assumed this would just work if the link criteria was present in the button code, however it appears that no matter what the "Property Code" the combo box displays all the data in the tblTraining table.
Anybody have any ideas?
Many thanks
View 1 Replies
View Related
Dec 6, 2004
Hi,
I have a form that runs a parameter query to search for university name and then displays 2 fields, university name and course name.
I am having difficulty with a search button that i have on the form called search_command; it is supposed to run the exact query as when you enter the form, it does this but displays the result in a dataheet, i want it to repopulate my 2 text label fields as mentioned above.
In addition i want then to be able to go to a specific record, select it and then press a button to append it to another table. i ahve not started this part yet
Can anyone please help ?
View 14 Replies
View Related
Apr 14, 2014
I have a table with Family_Name and Birthdate and tblxx_Familie_ID:
I am trying to create a recordset that selects all records that belong to a certaim Family and where the Person is under 216 months old (under 18)
Set ExternKinder = db.OpenRecordset("Select * from tbl_ExterneGeschwister where tblxx_familie_id=" & Familie!ID & " and " & "Datediff('m',[Geboren_am],[me![Buchungsdatum]) <= 216)
'Buchungsdatum is a filed on a form that I start the procedure from...
View 6 Replies
View Related
Jul 30, 2013
I have a scenario that I tried on an Excel forum but didn't have much luck. Conditions for my assignment:
1) Long description short, I have to randomly select 2 records for each client each month.
2) The catch is that these records have to be different states until the process is done for all 50 states, so the process isn't done for 4 years and 2 months (50 months).
I attached a sample database.
View 3 Replies
View Related
Apr 15, 2008
Hi,
Hope someone can help me out on this one. Searched the forum but can’t find anything to help me out.
I have two tables:
tblCustomers that contains unique customer records (names addresses etc.)
and
tblComments that contains comment data for the customers
Tables are joined one to many tblCustomers -> tblComments on account_ref
tblComments can contain several records per customer, all are datestamped.
I want just the latest datestamped comment record per customer, just can’t seem to work the logic on this one. Must be so simple but can’t fathom it.:confused:
Ideally, I’m producing a report of Customer data (Name, address, contacts etc) + the last comment record for each customer. Have started with a simple query, but have hit an impasse. Have tried sorting, group by, top 1, distinct etc, but don’t seem to be getting anywhere.:mad:
If someone can point me in the right direction, and give me a starter for 10 I’d be much appreciated.
View 1 Replies
View Related
Feb 2, 2005
Here is an example of what I am trying to do:
I have a main form which has 4 combo boxes all based on tblPeople.
Combo0 is skill
Combo1 is discipline
Combo2 is crart
Comb03 is active
The sub form is a datatable list of the tblpeople.
How do I apply the filter to the datatable. I am assuming I need to build a sql statement somewhere like SELECT from tlpeople WHERE me!combo0 = [tblpeople].[skill] and me!Combo1=[tblpeople].[discipline] etc
Is there a sample database? or can somebody tell me how to go about this.
Thanks
Steve
View 11 Replies
View Related
Oct 12, 2006
I'm working on a table which has a country field, but this field may contain a text string consisting of more than one country, eg "France, Belgium, Spain"
I want to run a query against the table to select records for any one country, but not sure how to do this.
Any suggestions please?
View 4 Replies
View Related