Results 1 to 13 of 13
  1. #1
    Join Date
    Mar 2003
    Location
    UK
    Posts
    85

    Question Unanswered: Not filtering hyperlink field

    Dear All

    I am using following code to open a form on OnClick event of a command button.

    myInt = InputBox("GIVE PIC NO", "GIVE!")
    stWhere = "[PIC NO] = '" & myInt & "'"
    DoCmd.OpenForm (frmName), acNormal, , stWhere

    When I click on command button, it prompts to enter PIC NO but does not fetch any relevant data.

    [PIC NO] field is a hyperlink field. It holds text like 124A, 34W etc.

    If the problem is due to being hyperlink field, is there any changes I can make in above code so that it would filter the relevant data.

    Thanks

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465

    Re: Not filtering hyperlink field

    Originally posted by dbase
    Dear All

    I am using following code to open a form on OnClick event of a command button.

    myInt = InputBox("GIVE PIC NO", "GIVE!")
    stWhere = "[PIC NO] = '" & myInt & "'"
    DoCmd.OpenForm (frmName), acNormal, , stWhere

    When I click on command button, it prompts to enter PIC NO but does not fetch any relevant data.

    [PIC NO] field is a hyperlink field. It holds text like 124A, 34W etc.

    If the problem is due to being hyperlink field, is there any changes I can make in above code so that it would filter the relevant data.

    Thanks
    do this change:


    myInt = InputBox("GIVE PIC NO", "GIVE!")
    stWhere = "[PIC NO] = " & myInt
    DoCmd.OpenForm (frmName), acNormal, , stWhere
    Saludos
    Norberto

  3. #3
    Join Date
    Mar 2003
    Location
    UK
    Posts
    85
    Thank you very much for your reply.

    I am not good in VB codes and specially these little notation symbols have alway confused me.

    I have used the corrected code but still it is giving me following error. If I enter e.g 124W

    "Syntex error (missing operator) in query expression"

    and if if just enter 124 in prompted input box then the error changes to

    Run time erro 2501
    Open form action was cancelled

    Looking forward to further advice

  4. #4
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    Sorry... i make a mistake, do this and tell me what happen

    Dim stWhere as String
    Dim myInt as String
    myInt = InputBox("GIVE PIC NO", "GIVE!")
    stWhere = "[PIC NO] = '" & myInt &"'"
    DoCmd.OpenForm (frmName), acNormal, , stWhere
    Saludos
    Norberto

  5. #5
    Join Date
    Mar 2003
    Location
    UK
    Posts
    85
    This is where we started from.

    It does open the form but does not display any data (same as before)

  6. #6
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    Originally posted by dbase
    This is where we started from.

    It does open the form but does not display any data (same as before)
    Please now is and question honor send me a sample base in Access 97 format and i see what is the problem, of course if you want.
    ok
    Saludos
    Norberto

  7. #7
    Join Date
    Mar 2003
    Location
    UK
    Posts
    85

    Smile

    Thanks for your reply.

    Let me also try other alternatives as well.

    If I am still unsuccessful, I wil come back to you.

    Thanks

  8. #8
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    See in the frmName if the property Data Entry is in "No" (False)
    Saludos
    Norberto

  9. #9
    Join Date
    Mar 2003
    Location
    UK
    Posts
    85
    It is set to No

  10. #10
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    Sorry but need see the two form, the record source of the second form and the datas in the table, some thing is bad in there. Its must work.
    Saludos
    Norberto

  11. #11
    Join Date
    Aug 2003
    Location
    Belgrade
    Posts
    68

    Re: Not filtering hyperlink field

    1. If your myInt variable is supposed to be a numeric value and the [PIC NO] is a hyperlink type field, containing values like 124A, 34W etc, it will be very hard to have equality.

    2. I am not sure you can search a hyperlink field the same way as any text field. When you say [PIC NO] = '" & myInt & "'", what part of the hyperlink do you want to search: the display value, address or subaddress part?

    I have no experience with hyperlink fields, so Im not sure this will work, but I would try the following:

    strWhere = "HyperlinkPart([PIC NO], acDisplayedValue) = '" & myInt & "'"

    Correct this statement if you need other parts of the hyperlink.

  12. #12
    Join Date
    Mar 2003
    Location
    UK
    Posts
    85
    In the main table [PIC NO] field property is set as hyperlink.

    I want to search the display value only. e.g 123A

    I have tried on a simple select query. If I put "123A" in criteria cell of PIC NO field, it does not fetch any record. But if I put "123*" it does pulls relevant data for 123A.

  13. #13
    Join Date
    Mar 2003
    Location
    UK
    Posts
    85

    update

    Here is an update on the above issue.

    At last today I have managed to solve the problem with the help of someone.

    Here is the solution

    stWhere = "[PIC NO] Like '*" & [myInt] & "*'"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •