Results 1 to 9 of 9
  1. #1
    kcrty is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Posts
    8

    Trying to pull data from table into VBA code

    Hey guys,

    Yes, I'm a NooB, I'm usually pretty quick at figuring things out via google-youtube, but I've been stuck for 3 days now.

    I need to pull info from a table and insert it into my code (see below).

    Private Sub cmdMBHPelig_Click()

    Set objIE = CreateObject("InternetExplorer.Application")
    objIE.Top = 0
    objIE.Left = 0
    objIE.Width = 1400


    objIE.Height = 950
    objIE.AddressBar = 0
    objIE.StatusBar = 0
    objIE.Toolbar = 0
    objIE.Visible = False 'We will see the window navigation
    objIE.Navigate ("web url")

    Do
    DoEvents
    Loop Until objIE.ReadyState = 4

    objIE.Document.GetElementByid("loginForm:loginPane l:username").value = "usernameid"
    objIE.Document.GetElementByid("loginForm:loginPane l assword").value = "password"
    objIE.Document.GetElementByid("loginForm roviderLogin_1_id3:submitButton").Click
    Do
    DoEvents
    Loop Until objIE.ReadyState = 4

    objIE.Visible = True
    objIE.Document.GetElementByid("form1: eligibilitySearch: member_memberID").Value = "need to pull string from table"
    objIE.Document.GetElementByid("form1:verifyMemberE ligibility_1_id21:verifyMemberEligibility_1_id22") .Click

    Do
    DoEvents
    Loop Until objIE.ReadyState = 4

    End Sub

    'Table: - Client demographic table, "a demographics"
    'Records: (strings - based on !me/current-active record)
    'Fields, 'name, address, city, state, phone etc.
    'Entire field.....

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Depending on specifics, a DLookup() or a recordset.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    kcrty is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Posts
    8
    Thanks pbaldy! I actually looked at both of these. I could not get Dlookup to work...

    Dim usern As String
    Dim passw As String
    Dim memid As String
    Dim DOB As String

    usern = DLookup("[un]", "ztbl_pw", "[id] = 2")

    Debug.Print usern

    I created a table with fields usern-username, pw-password, memid-member id and dob. The code above didn't work, I'm also not sure how to get the
    results where I need it to be in the code. Maybe type Value = "usern" ?

    any thoughts?

    I started looking into recordsets yesterday. I get a .dll error when trying to import the DAO library. So I'm trying to resolve that as well....

  4. #4
    darwish is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    26
    Quote Originally Posted by kcrty View Post
    Hey guys,

    Yes, I'm a NooB, I'm usually pretty quick at figuring things out via google-youtube, but I've been stuck for 3 days now.

    I need to pull info from a table and insert it into my code (see below).

    Private Sub cmdMBHPelig_Click()

    Set objIE = CreateObject("InternetExplorer.Application")
    objIE.Top = 0
    objIE.Left = 0
    objIE.Width = 1400
    objIE.Height = 950
    objIE.AddressBar = 0
    objIE.StatusBar = 0
    objIE.Toolbar = 0
    objIE.Visible = False 'We will see the window navigation
    objIE.Navigate ("web url")

    Do
    DoEvents
    Loop Until objIE.ReadyState = 4

    objIE.Document.GetElementByid("loginForm:loginPane l:username").value = "usernameid"
    objIE.Document.GetElementByid("loginForm:loginPane l assword").value = "password"
    objIE.Document.GetElementByid("loginForm roviderLogin_1_id3:submitButton").Click
    Do
    DoEvents
    Loop Until objIE.ReadyState = 4

    objIE.Visible = True
    objIE.Document.GetElementByid("form1: eligibilitySearch: member_memberID").Value = "need to pull string from table"
    objIE.Document.GetElementByid("form1:verifyMemberE ligibility_1_id21:verifyMemberEligibility_1_id22") .Click

    Do
    DoEvents
    Loop Until objIE.ReadyState = 4

    End Sub

    'Table: - Client demographic table, "a demographics"
    'Records: (strings - based on !me/current-active record)
    'Fields, 'name, address, city, state, phone etc.
    'Entire field.....
    Dear

    What are the types of tables you need to pull from?
    are they ms access tables?
    or another type of tables?

    Where exactly you want to pull them?
    Select Data you mean?

    Kindly be more specific and give more details in order to help you in a correct way

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Quote Originally Posted by kcrty View Post
    Thanks pbaldy! I actually looked at both of these. I could not get Dlookup to work...

    Dim usern As String
    Dim passw As String
    Dim memid As String
    Dim DOB As String

    usern = DLookup("[un]", "ztbl_pw", "[id] = 2")

    Debug.Print usern

    I created a table with fields usern-username, pw-password, memid-member id and dob. The code above didn't work, I'm also not sure how to get the
    results where I need it to be in the code. Maybe type Value = "usern" ?

    any thoughts?

    I started looking into recordsets yesterday. I get a .dll error when trying to import the DAO library. So I'm trying to resolve that as well....
    You'd use usern instead of un in the first argument. Later versions of Access include the DAO reference by default.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    kcrty is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Posts
    8
    Thanks Darwish!

    It is an access 2010 table. fields; id, description, username, password, other, date_pw_changed

    The line of code where I need to insert the data (depending on which of the clinicians databases I an loading the code into)=

    objIE.Document.GetElementByid("form1: eligibilitySearch: provider_username").Value = "need to pull string from table"

    Type of data = strings

    I would also like to pull information from the active record or a form. Fields = First Name, Last Name, etc....

    thanks for your time and patience guys...

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Did you see post 5? You can get data from a form:

    http://access.mvps.org/access/forms/frm0031.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    kcrty is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Posts
    8
    Thanks guys! I've come to realize that I'm not quite skilled enough just yet to ask the right questions.

    I'll going to watch some video's / do some reading and repost when I can conceptualize the code at a higher level.

    Thanks for your patience!

    For anyone else in my shoe's, there is a programmer, Steve Bishop, who took the time to make an excellent video series, which can be found here >https://www.youtube.com/watch?v=9OVi...03jQ_t9nFV737s

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    You might find Crystal's videos helpful as well:

    https://www.youtube.com/user/LearnAccessByCrystal
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 10-15-2013, 10:41 AM
  2. Pull Data from another table
    By bbranco in forum Access
    Replies: 1
    Last Post: 06-19-2013, 06:15 AM
  3. Replies: 3
    Last Post: 08-02-2012, 10:27 AM
  4. pull up data from a table into a form
    By MattD00 in forum Forms
    Replies: 1
    Last Post: 03-30-2011, 08:15 AM
  5. Code to pull in data from a specific record
    By jdunn36 in forum Access
    Replies: 1
    Last Post: 09-20-2010, 11:54 AM

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