Page 2 of 2 FirstFirst 12
Results 16 to 30 of 30
  1. #16
    DavidMcA18 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2016
    Posts
    20
    Thats strange because both fields are the same they are both Ref_Number.

    The set up is -

    Datasheet with Ref_Number (PK) set as a hyperlink, on click = DoCmd.OpenForm "Job_Info", , , "Ref_Number = ' " & Me.Ref_Number & "'"

    Job_Info is a form which contains the info from the job in a more detailed way.

  2. #17
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    You mean Ref_Number used to FILTER to one record.
    The code you gave will work if that field is TEXT datatype.

    If as the name suggests it's a NUMBER field, then use

    DoCmd.OpenForm "Job_Info", , ,"Ref_Number =" & Me.Ref_Number
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #18
    PrimaryKey is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Feb 2018
    Posts
    42
    Quote Originally Posted by DavidMcA18 View Post
    Hi Guys, this post helped me for this but I have a problem with this

    I have this linked up on a datasheet and when i click to open the form i get a pop up text box asking about parameters. After i click close it opens the form with no data.

    Can anyone suggest anything?
    ridders52 is exactly right. I can also add that I was getting this messge when I was trying to pass a PK value from my main form to my popup form, which then acted as a filter to determine which record was shown in the popup. For example I was opening a sales orders details subform and using OpenArgs to pass teh SalesOrderID to the form. I was getting the same message you're getting when my function had typos, which resulting in the SalesOrderId not passing the necessary variable.

    What happens if you enter a value when it requests a parameter? Are you passing any variables to the popup form? Or are you using an OpenArgs WHERE statement to select the popup's record? Or is your intent to open the popup in such a way that you can browse through all available records?

  4. #19
    DavidMcA18 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2016
    Posts
    20
    Could i email it across to you for a look? I think im getting myself more confused the more i think about it!

  5. #20
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    What datatype is the Ref_Number field? Text or number?
    Open the table in design view to check.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  6. #21
    DavidMcA18 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2016
    Posts
    20

  7. #22
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    The field names have spaces, not underscore. Advise not to use spaces nor punctuation/special characters (underscore only exception) in naming convention.

    Did you name a textbox Ref_Number, with the underscore? If yes, try:

    DoCmd.OpenForm "Job_Info", , ,"[Ref Number] =" & Me.Ref_Number

    if not:

    DoCmd.OpenForm "Job_Info", , ,"[Ref Number] =" & Me.[Ref Number]

    Both presume the form name follows the naming convention of the table name and uses underscore.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #23
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Further to June's comments, is the form called Job_Info (underscore) or Job Info (with a space)?
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  9. #24
    John_G is offline VIP
    Windows 10 Access 2016
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    ...when i click to open the form i get a pop up text box asking about parameters.
    This will also happen if in a query criteria you reference a form that is not open. What is the record source for the popup form you want to open? If it is a query, are there any criteria used in it?

  10. #25
    DavidMcA18 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2016
    Posts
    20
    Hi Guys,

    [LINK REMOVED]

    Link for the database, its not letting me upload it on here. Possibly my internet connection.

  11. #26
    DavidMcA18 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2016
    Posts
    20
    Quote Originally Posted by ridders52 View Post
    Further to June's comments, is the form called Job_Info (underscore) or Job Info (with a space)?
    Job_Info - it did have a space then i changed it to so it has an underscore

  12. #27
    DavidMcA18 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2016
    Posts
    20
    New Compressed (zipped) Folder.zip

    Sorry, here is the file now. i didnt ZIP before

  13. #28
    John_G is offline VIP
    Windows 10 Access 2016
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    I looked at your database, but I cannot replicate your error. I have to admit that I don't like or use macros, so I converted them to VBA to see what they were doing. I can't see anything that might generate that error.

    Which button on which form is giving you the error?

  14. #29
    DavidMcA18 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2016
    Posts
    20
    the form which is a datasheet. i want to be able to click on the Ref_Number and it links to Job_Info

  15. #30
    John_G is offline VIP
    Windows 10 Access 2016
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    OK, found it. There are two mistakes:

    First, the reference number field in the Tender_List table is [Ref Number] - with a blank, not an underscore.
    Second, the [Ref Number] is numeric, not a string, so you can't enclose it in quotation marks.

    Change your docmd line to:

    DoCmd.OpenForm "Job_Info", , , "[Ref Number] = " & Me.Ref_Number

    and it works fine.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Hyperlink opens duplicate window
    By gunitinug in forum Access
    Replies: 1
    Last Post: 09-04-2017, 05:39 PM
  2. Replies: 1
    Last Post: 06-22-2017, 12:15 PM
  3. Replies: 8
    Last Post: 09-09-2015, 07:07 AM
  4. Replies: 1
    Last Post: 02-29-2012, 09:38 AM
  5. Form opens table in datasheet view
    By franklbl in forum Forms
    Replies: 9
    Last Post: 03-23-2011, 09:43 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