Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Search Form Seeked Access 2003?

Status
Not open for further replies.

Maillme

Technical User
Mar 11, 2003
186
NL
Hi there,

about 3 years ago i came across a tutorial explaining how to build a custom form that allowed me to search for records using field(s) i chose,and displayed them in list within a subform, which then allowed me to double click to open that record.

Can anyone point me in the direction of how to create something similar? or the tutorial?

many thanks,
Neil
 
Alot of little questions rolled into one.
First, it should be posted in Microsoft: Access Forms.

Examples in Access 97 Programming for Windows for Dummies,
Microsoft Access 97 Visual Basic
etc. through 2003.

You can also do a search in the Access forums(seven of them).

To get you started: you can have a combobox with your values. When a selection is made, the code on the AfterUpdate event will create a query(SQL) that will retrieve those records with that info. This can them be displayed in a listbox. The user can then double click a selection which will bring up a detail record.

The following has ctrllist as the listbox name and the combobox is showing dates.

On the AfterUpdate event of the combobox:
Private Sub comboboxname_AfterUpdate()
Dim SQLText, ctrllist As ListBox
SQLText = _
"Select Orders.[Order Number], Orders.Customer, " _
& "Orders.Total, Orders.[Order Date] From Orders " _
& "where (((Orders.[Order Date])=#" _
& Me![Comboboxname] & "#)) " _
& "Order By Orders.[Order Number], Orders.Customer;"
Me![ctrllist].RowSource = SQLText
Me![ctrllist].Requery
End Sub

Then on the listbox's double click event you can have a macro that has the following:
OpenForm and the Where Condition having:
[Order Number]=[Forms]![Formname]![ctrllist]

Please post any other questions on this in the Access forums. You'll get answers from the Access experts.
 
apologies, ive no idea why i posted in here!!

thanks for your response!

Neil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top