A way to make jump-to by typing enabled, but data editing disabled?

Margarita

Registered User.
Local time
Today, 15:21
Joined
Aug 12, 2011
Messages
185
Hello,
I have a nested set of invoice-per-vendor forms.
Main form: vendors
child: invoices
grandchild: invoice details

I am using this form for the user to ONLY review existing invoices- no data entry/editing should be happening here.

I set the locked property to 'yes' for the textbox control that shows the invoice number on the child form. This accoplishes what I want- it keeps the user from editing the invoice number. However, this has the unwanted effect of keeping the user from being able to jump to a specific invoice by typing in the desired invoice number and hitting enter. Right now, the user has to scroll through the invoice list to find the one they want because the field is locked and does not allow any typing in it.

I may be misunderstanding the Locked property, but as far as I can see, I cannot prevent data editing and have the jump-to search funcitonality on one form at the same time. Are there any workarounds for this? Does anyone know of a way for me to have the control both locked and 'type-in searchable'?

Thank you!!
 
Instead of locking every control on the form, try me.allowedits = false

This will ban users from editing records in the form.
 
Instead of locking every control on the form, try me.allowedits = false

This will ban users from editing records in the form.


Hi Sam, sorry if this is a really basic question- where would I have to set that allowedits property? In the on load event of the child (invoices) form?

Thank you!!
 
Depends on your application really. You can even change that property in design time if that subform is never meant accept edits.
 
Depends on your application really. You can even change that property in design time if that subform is never meant accept edits.

Hi Sam,
I just tried setting the allowedits property of the Invoices form to No and then unlocking the controls. This seems to have the same effect as having the controls locked- I am not able to type in the fields to jump to a specific record. Are there any workarounds to this?

Thanks!
 
Well you just told the form to ban edits, is that not what you wanted?

If you want to lock a control or two, then the lock property would be the way to go, if you want to lock the whole record, I'd change the AllowEdits property.
 
Well you just told the form to ban edits, is that not what you wanted?

If you want to lock a control or two, then the lock property would be the way to go, if you want to lock the whole record, I'd change the AllowEdits property.

The locking for edits is one of the pieces that I need to have for the form, yes, but the other one that is a concern for my user is the ability to jump to a specific invoice by typing in the desired invoice number in the invoice field, without having to scroll through all the invoices. Essentially, I need a quick and efficient way to search for an invoice in the invoice field, but NOT give the user the ability to edit any of the invoice numbers. I suspect that both pieces of functionality are not possible on the same form, but I was just giving it a shot by posting this question.

Thanks for your help!
 
Hmmm sounds like filter is your friend then. Try this:

Code:
Me.filter = "InvoiceNumber = " & inputbox("Enter Invoice Number")
Me.filterOn = true
 
Hmmm sounds like filter is your friend then. Try this:

Code:
Me.filter = "InvoiceNumber = " & inputbox("Enter Invoice Number")
Me.filterOn = true


Can I run this by you just so I know I am understanding correctly:

-On the Invoices form, I need to create an unbound textbox where the user would enter the invoice number to search
-create a button that the user clicks after typing in the invoice number to search. The on click even of this button would contain the code that you posted above.
-the form gets filtered

Am I understanding the set up correctly?

Thank you for you help!! I feel like I'm making more progress on this than I have in days.
 
Ooh! This is fancy stuff!! It will take me some time to look through it and customized for my form (which is rather simple, really- nothing fancy in it- well, until I put your code in, that is!)

I have started looking into the filter approach that Sam outlined for me. I will explore both ways and see which one works better for my simple set up and post back here with the results.

Thanks to both of you for very helpful information!
 
Can I run this by you just so I know I am understanding correctly:

-On the Invoices form, I need to create an unbound textbox where the user would enter the invoice number to search
-create a button that the user clicks after typing in the invoice number to search. The on click even of this button would contain the code that you posted above.
-the form gets filtered

Am I understanding the set up correctly?

Thank you for you help!! I feel like I'm making more progress on this than I have in days.

Yup, if you want to filter based on a text box, just remove the input box part and replace it by the name of your textbox. Let's say the name of your textbox is MySearchTextbox, and InvoiceNumber is the name of your InvoiceNumber field in your invoices table then your code becomes:

Code:
Me.filter = "InvoiceNumber = " & Me.MySearchTextbox
Me.filterOn = true

Try it and let me know how it goes.

You can also fancy it up by eliminating the command button and have the form filter as you type. I'll show you how once you report a success to the above. ;)
 
Yup, if you want to filter based on a text box, just remove the input box part and replace it by the name of your textbox. Let's say the name of your textbox is MySearchTextbox, and InvoiceNumber is the name of your InvoiceNumber field in your invoices table then your code becomes:

Code:
Me.filter = "InvoiceNumber = " & Me.MySearchTextbox
Me.filterOn = true

Try it and let me know how it goes.

You can also fancy it up by eliminating the command button and have the form filter as you type. I'll show you how once you report a success to the above. ;)

Hi Sam,
I made a textbox called InvoicetoSearch and a button. In the button's on click event I put:

PHP:
Private Sub FilterInvoicesButton_Click()
Me.Filter = "InvoiceNum = " & Me.InvoicetoSearch
Me.FilterOn = True
End Sub

I just tried to test it and I am getting a run-time error number 2448: "You can't assign a value to this object." Did I miss something in the set-up? Is my 'Me' object referring to something that it's not supposed to (I thought that 'me' always refers to the form or subform on which the control with the code is located- so in my case, the Invoices subform).
Please help!

Thank you!
 
Weird, I put the below code in my form:

Code:
Private Sub Command7_Click()
Me.Filter = "empid=" & Me.txtfilter 
Me.FilterOn = True
End Sub

And it did the trick. Sounds like a problem with your textbox settings
 
Weird, I put the below code in my form:

Code:
Private Sub Command7_Click()
Me.Filter = "empid=" & Me.txtfilter 
Me.FilterOn = True
End Sub

And it did the trick. Sounds like a problem with your textbox settings


Hmmm... I am trying to figure out why I'm getting the error. My InvoicetoSearch textbox is unbound and has a blank format- the same format as my InvoiceNum control. I am playing around with it to see where I'm going wrong. In the meantime, you mentioned that there was a way to get the form to filter as you're typing? Is it similar to how Michael, who also posted a reply to this thread does search-as-you-type in his code?

Thanks!
 

Users who are viewing this thread

Back
Top Bottom