Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Seattle, Washington, USA
    Posts
    179
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SetValue Method doesn't show up

    This is slightly different question than the one I posted yesterday about using DoCmd. Thanks to Rory for his suggestion which worked perfectly!

    This time, I have a new question... In the Microsoft Access 2000 Visual Basic for Applications Fundamentals book, there is a section on setting a DefaultValue method...For example, if I have a main form open, but then I want to enter payments for that particular record, then I would click on a button that opens Enter Payment form which automatically sets the Subscriber name to match the main form. In order to do this, in the OnOpen property, I would create a short code that looks like this:

    If IsOpen("Subscribers") Then
    SubscriberID.DefaultValue = Forms!Subscribers!SubscriberID
    End If

    I tried it out on the practice file that came with the book and it works perfectly. Exactly what I needed...HOWEVER...When I try this in MY OWN DATABASE, I don't get full list of Visual Basic commands! I only get single command - "Value". I tried entering this particular command in a new form in the practice file, same thing. Only the "Enter Payment" form would allow me to see full list of Visual Basic commands, including SetValue! I even compared the property sheets and couldn't find anything different.

    Why is this happening?

    Thanks in advance.

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: SetValue Method doesn't show up

    Hi Brent,
    That situation would arise if you're dealing with an autonumber field and the control on the form does not have the same name as the field itself - e.g. the field SubscriberID is an autonumber field and the control on the form is called txtID. If you type SubscriberID then a period in code you will only see 'Value' as an option. Is that the situation you're dealing with?
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Seattle, Washington, USA
    Posts
    179
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SetValue Method doesn't show up

    Man! You are a KNIGHT IN A SHINING ARMOR!

    If you ever are in Seattle area, give me a ring and I'll treat you to a dinner! Smile.

    By the way, how do you know all of this arcane stuff? The book never mentioned this nor did the Microsoft support website or help files.

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: SetValue Method doesn't show up

    Mostly it's just stuff I've read or come across that triggers a memory and then a bit (or a lot sometimes!) of research does the rest (if you look up DefaultValue in Help it tells you something about this). Or, according to my Better Half, it's because I'm an anally-retentive geek. Take your pick! <img src=/S/smile.gif border=0 alt=smile width=15 height=15>
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

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