Page 3 of 3 FirstFirst 123
Results 31 to 35 of 35
  1. #31
    Wayne311 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2011
    Posts
    91
    Quote Originally Posted by ajetrumpet View Post
    alright Wayne. I dropped all the source, and gave you an example.



    attached is it. put a number in the top left box and see the charge appear.

    Regardless of whether a parent child relay is present, you would have eventually run into the fact that your ID field in the table is TEXT, not a number.

    vba syntax is different for these two datatypes, and confusing to boot.
    Can you help me understand how this works?

    As I understand you...this represtents dissimilar data types:

    Me.Charge = DLookup("Charge", "Districts", "[District] = '" & Forms(Me.Parent.Name).Controls("CaseNumber Subform1").Form!District & "'")

    How would it change for similar data types (both numbers)?

    Thanks
    Wayne

  2. #32
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Here is a good link to review: http://www.mvps.org/access/general/gen0018.htm

  3. #33
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by Wayne311 View Post
    Me.Charge = DLookup("Charge", "Districts", "[District] = '" & Forms(Me.Parent.Name).Controls("CaseNumber Subform1").Form!District & "'")

    How would it change for similar data types (both numbers)?
    'D' functions only change syntax, as it relates to data types, in the criteria argument. and moreover, working with criteria statements in access, via code or interface is always unnecessarily complex. Don't ask me why, I don't know. The data type that inevitably ends up being thrown into the right side of an operator sign in a criteria statement ALWAYS dictates the format of the quotation and symbol syntax.

    the above example, when used with a number, would be:
    Code:
    Me.Charge = DLookup("Charge", "Districts",
    
     "[District] = " & Forms(Me.Parent.Name).Controls("CaseNumber Subform1").Form!District)
    that's called concatenating a value out

    you can also concat it in

    the difference between doing it IN and OUT is almost strictly related to numbers and dates VS. text.

    this is IN:
    Code:
    "something = '" & textvalueReference & "'"
    
    if you print statements like this out in the immediate window, what you see is this:
    something = 'textvalueReference'
    this is OUT:
    Code:
    "something = " & numbervalueReference
    
    if you print statements like this out in the immediate window, what you see is this:
    something = numbervalueReference
    and this is also OUT:
    Code:
    "something = #" & datevalueReference & "#"
    
    if you print statements like this out in the immediate window, what you see is this:
    something = #datevalueReference#
    that's the best I can do.

    please please PLEASE read what Allan posted. MVPS has about the simplest explanations that you're going to find on the web. At least those that come from a tutorial-type website. (I don't read their stuff....I only use their freebie services to block annoying advertisements on forums like this. )

  4. #34
    Wayne311 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2011
    Posts
    91
    Thanks for both posts. That helps a lot.

    Wayne

  5. #35
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    can we marked this as solved, Wayne?

    Actually, I'm going to...and if you have more questions pls start another thread.

Page 3 of 3 FirstFirst 123
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Pass Subform filter to subform in report
    By camftm in forum Programming
    Replies: 16
    Last Post: 07-19-2011, 07:12 AM
  2. Replies: 15
    Last Post: 11-09-2010, 04:27 PM
  3. Subform Question
    By Desverger in forum Forms
    Replies: 1
    Last Post: 08-11-2010, 02:42 PM
  4. Data from one subform to anther subform
    By scotribs in forum Forms
    Replies: 3
    Last Post: 03-09-2010, 09:53 AM
  5. Replies: 1
    Last Post: 12-10-2005, 04:52 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