• SetValue Method doesn’t show up

    Author
    Topic
    #355872

    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.

    Viewing 0 reply threads
    Author
    Replies
    • #525747

      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?

      • #525748

        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.

        • #525750

          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! smile

    Viewing 0 reply threads
    Reply To: SetValue Method doesn’t show up

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: