Conditional format form based on text in txtfield

WalterInOz

Registered User.
Local time
Tomorrow, 09:43
Joined
Apr 11, 2006
Messages
93
Hi All,

I'd lile to show/hide selected subforms based on the the text in a txtfield.
The text in the selection field (txtSelect) I'd like to use for that may be either one of the following:

book-01, book-02, book-03 etc OR,
folder-01, folder-02, folder-03 etc OR,
record-01, record-02 record-03 etc. OR
it can be just a 4 digit number.

If the txtSelect contains "book" I'd like the subfrmBookdetails to be visible.
If the txtSelect contains "folder" obviously the subfrmFolderdetails etc.

What I'm struggling with is the If-Then statement for selecting the partial text in txtselect.

I've tried things like this:
On current
me.txtSelect.setfocus
if me.txtSelect.text="book*" then
me.subfrmBookdetails.visible=true etc etc.

No joy.

I know how to get this to work in a query with a like-statement but I have not been able to find anything on this in relation to conditional formatting of a form. Any one and good ideas?

Thanks,
Walter
 
WalterInOz said:
If the txtSelect contains "book" I'd like the subfrmBookdetails to be visible.
If the txtSelect contains "folder" obviously the subfrmFolderdetails etc.

What I'm struggling with is the If-Then statement for selecting the partial text in txtselect.

I've tried things like this:
On current
me.txtSelect.setfocus
if me.txtSelect.text="book*" then
me.subfrmBookdetails.visible=true etc etc.
Try

Code:
If Me.txtSelect Like "book*" Then
    Me.subfrmBookdetails.Visible = true
Elseif Me.txtSelect Like "folder*"
    Me.subfrmFolderdetails.Visible = True
End If

You'll need to set the unwanted subfrms to invisible also, otherwise, once you've made them visible they will stay visible as you scroll through every record.

hth
Stopher
 
Excellent!!

Thanks Stopher
 

Users who are viewing this thread

Back
Top Bottom