Results 1 to 2 of 2
  1. #1
    Dominaz is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2011
    Posts
    21

    Operator Like using wildcards with variables..

    Hello!


    I want to use the operator like to compare two fields of two different forms and then give a value to another field...

    If Forms!Teachers!Subject.Value Like Forms!Booking!Subject.Value Then
    Forms!Teachers!Score.Value = 2
    End If

    This works fine, but if I want to use * ,(Maybe someone write Math, instead on Mathematics....) then things doesn't work...


    If Forms!Teachers!Subject.Value Like Forms!Booking!Subject.Value & "*" Then
    Forms!Teachers!Score.Value = 2
    End If


    2) I also have another question, How can I use the like operator to compare only the first 3 characters of two fields ???

    Thank you very much.

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    For your second question - try something like this:

    If Left(Forms!Teachers!Subject.Value, 3) Like Left(Forms!Booking!Subject.Value, 3) Then . . .

    Let me know if that works.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. WildCards in VB Code
    By Juan4412 in forum Programming
    Replies: 5
    Last Post: 06-25-2011, 10:50 PM
  2. VBA Wildcards
    By dssrun in forum Programming
    Replies: 11
    Last Post: 03-31-2011, 08:44 AM
  3. SQL Wildcards
    By sandlucky in forum Queries
    Replies: 4
    Last Post: 03-28-2011, 03:31 AM
  4. Using wildcards (*) in SQL
    By SIGMA248 in forum Queries
    Replies: 1
    Last Post: 07-22-2010, 08:44 PM
  5. Wildcards?!
    By esx_raptor in forum Access
    Replies: 3
    Last Post: 02-19-2010, 03:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums