Hello,
I am VERY frustrated and annoyed over having spent a ridiculous amount of time on something that should be very simple. I have a form of vendors, with a subform of invoices, which also has a subform with invoice details. All the fields are locked- I only want the user to use this form for review of data, not data entry. What I want to be able to do is jump to a specific invoice on the Invoices subform by typing it in, so you don't have to scroll through all the invoices to find the one you want.
I have posted a thread here before about getting help with some kind of search-as-you-type functionality, but that was no help- there are various versions of code for that all over different forums, but I can't get any of them to work. So-- I decided to go with a simpler approach:
-created a textbox called InvoicetoSearch where the user can type in the invoice number string they want to jump to
-created a button and in its on click event I want to filter the Invoices subform by the invoice number specified in InvoicetoSearch (i.e. filter the InvoiceNum field on Invoices_subform)
I first tried the filteron approach:
But I kept getting the error 2448 "You can't assign a value to this object". I've played with that code for a long time, did reasearch on the syntax and the way .filter should be used. NOTHING. I can't see what I'm doing wrong. I'm copying the code directly from the help files, only modifying the control names to fit my form. It's still not working.
So, on the verge of tears and mental insanity, I put that aside and decided to try the docmd.applyfilter approach:
Using this, when I click the button, I get asked for Invoicenum as a parameter. When I type it in, I get the form filtered, but if I leave it blank, the form is blank, obviously. This is NOT what I want. Why should the user have to type in the invoice number in the parameter box when she has already put it in InvoicetoSearch? Why is the value of InvoicetoSearch not taking through the ApplyFilter in the button's on click event? What am I missing?
I am begging for someone to shed some light on this. I realize that this is something very rudimentary and anyone with a little vba experience is going to laugh at my stupidity. But even if you laugh to yourself- I am BEGGING- please help! I have gone through four boxes of tissues and about to try the bang-head-on-wall approach.
THANK YOU!!
I am VERY frustrated and annoyed over having spent a ridiculous amount of time on something that should be very simple. I have a form of vendors, with a subform of invoices, which also has a subform with invoice details. All the fields are locked- I only want the user to use this form for review of data, not data entry. What I want to be able to do is jump to a specific invoice on the Invoices subform by typing it in, so you don't have to scroll through all the invoices to find the one you want.
I have posted a thread here before about getting help with some kind of search-as-you-type functionality, but that was no help- there are various versions of code for that all over different forums, but I can't get any of them to work. So-- I decided to go with a simpler approach:
-created a textbox called InvoicetoSearch where the user can type in the invoice number string they want to jump to
-created a button and in its on click event I want to filter the Invoices subform by the invoice number specified in InvoicetoSearch (i.e. filter the InvoiceNum field on Invoices_subform)
I first tried the filteron approach:
PHP:
Private Sub FilterInvoicesButton_Click()
Me.Filter = "InvoiceNum = " & Me.InvoicetoSearch.Value
Me.FilterOn = True
End Sub
But I kept getting the error 2448 "You can't assign a value to this object". I've played with that code for a long time, did reasearch on the syntax and the way .filter should be used. NOTHING. I can't see what I'm doing wrong. I'm copying the code directly from the help files, only modifying the control names to fit my form. It's still not working.
So, on the verge of tears and mental insanity, I put that aside and decided to try the docmd.applyfilter approach:
PHP:
DoCmd.ApplyFilter , "Invoicenum = '" & Me.InvoicetoSearch & "'"
Using this, when I click the button, I get asked for Invoicenum as a parameter. When I type it in, I get the form filtered, but if I leave it blank, the form is blank, obviously. This is NOT what I want. Why should the user have to type in the invoice number in the parameter box when she has already put it in InvoicetoSearch? Why is the value of InvoicetoSearch not taking through the ApplyFilter in the button's on click event? What am I missing?
I am begging for someone to shed some light on this. I realize that this is something very rudimentary and anyone with a little vba experience is going to laugh at my stupidity. But even if you laugh to yourself- I am BEGGING- please help! I have gone through four boxes of tissues and about to try the bang-head-on-wall approach.
THANK YOU!!