code for view button.

buggy2

Board Regular
Joined
Feb 28, 2003
Messages
69
hello, firstly i am a novice when it comes to vb for ms access code but well up on vb and vb for excel. I have a form with a number of combo boxes, on the first the user selects the day of the week and on the second the time of day by hour.

I now have a button and when this is clicked I wish to show all the records which fit the criteria in the same manner as a query would.(i.e. all the data that was entered into the database at 12pm on friday for example.) Data loaded every hour.

I expect this is very easy, but I have never had to use this before an its a one off.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
If I understand your problem right, build a query which captures the fields that you want captured (in this case, Date, Time, and whatever else you need). In the criteria under Date, write:
Forms![YourDataEntryForm].Form![YourDateComboBox]
Under Time write:
Forms![YourDataEntryForm].Form![YourTimeComboBox]
Now, using the wizard, put a command button on the form, Miscellaneous, Run Query, select the query that you just wrote. This will filter your recordset to only what you have selected in the Combo Boxes.
 
Upvote 0

Forum statistics

Threads
1,221,501
Messages
6,160,177
Members
451,629
Latest member
MNexcelguy19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top