[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Help - Update split form using text box, combo box, and button

Posted on 2007-08-02
4
Medium Priority
?
394 Views
Last Modified: 2013-11-28
Note: I'm using Access 2007.

I have a database with one table containing a bunch of data that was moved over from a spreadsheet. I have one form (split form) that shows the data from the table. Currently the record source for the form is simply the table.

When the form is opened I want to display all of the data from the table, however, each person using the form will need to filter the data based on their name and the date. I have added a text box for the date and a combo box for their name.

Form = migrationtracker
Text box = txtDate
Combo box = cbxTech

I have also added a button that I want to execute the filter command.

Button = btnUpdate

So basically what I want to do is update the form record source to be a query that is filtered by the Tech name and the date. I figured it would be something like this:

SELECT MigrationData.ID, MigrationData.UserID, MigrationData.AcctType, MigrationData.AcctNumber, MigrationData.MigrationTech, MigrationData.TargetDate, MigrationData.UserDom, MigrationData.MachineDom, MigrationData.AdminRights, MigrationData.TargetOU, MigrationData.AssetID, MigrationData.UserStatus, MigrationData.ComputerStatus, MigrationData.CompleteDate, MigrationData.Comments, MigrationData.LastName, MigrationData.FirstName, MigrationData.Shift, MigrationData.Telephone, MigrationData.Email, MigrationData.Combined, MigrationData.State, MigrationData.City, MigrationData.Department
FROM MigrationData
WHERE (((MigrationData.MigrationTech)=[Forms]![MigrationTracker]![cbxTech]) AND ((MigrationData.TargetDate)=[Forms]![MigrationTracker]![txtDate]));

It's been a while since I have done something like this and for some reason I'm just not getting it right. Any help would be much appreciated.

Thanks!! :)
0
Comment
Question by:zpetersen
  • 2
4 Comments
 
LVL 3

Expert Comment

by:kaosyeti
ID: 19621301
try using

me.filter = "XYZ"
me.filteron = true

Of course, you should put your criteria in for XYZ...8)
0
 
LVL 58

Accepted Solution

by:
harfang earned 500 total points
ID: 19621317
You don't need to change the record source. Simply set a filter:

Private Sub cmdFilter_Click()

    Me.Filter = "MigrationTech = [cbxTech] And TargetDate = [txtDate]"
    Me.FilterOn = True

End Sub

Leave the table as record source.

(°v°)
0
 

Author Comment

by:zpetersen
ID: 19624904
Both worked. Thanks to Harfang for the full solution.
0
 
LVL 3

Expert Comment

by:kaosyeti
ID: 19625184
hey... i posted my answer from my car on my iphone.... i think a little understanding is in order for my not copying your full filter...:P

j/k
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question