Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 14th, 2005, 09:03 AM
Sherrie Sherrie is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 155 Sherrie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 57 m 26 sec
Reputation Power: 5
Unbound TextBoxes to Display Data From Access Tables

Hi all,

I'm trying to create forms in VB (2005 Express Edition) where after data is entered into a textbox, it checks the database for existing records. If there is an existing record, the other textboxes are to be populated with the data.

I have done this in VBA for Access Forms, but I'm really new to VB.

The following is what I used in VBA. For some reason, i can't seem to use DAO even though I've added the reference in VB.

Can someone please teach me how to change the syntax so that I can code in VB?

Code:
Private Sub cmboWPNO_AfterUpdate()

Dim DAOdb As Database
Dim DAOrs As DAO.Recordset
setDAODb = CurrentDb()
Set DAOrs = DAOdb.OpenRecordset("Select * from tblEEPersonal where WPNO = '" & Me!cmboWPNO.Column(0) & "'")

    With DAOrs
    Me.txtWPNO = .Fields("WPNO")
    Me.txtName = .Fields("Name")
    Me.txtEEID = .Fields("EEID")
    Me.txtDOB = .Fields("DOB")
    Me.optNationality = .Fields("Nationality")
    Me.txtPPNO = .Fields("PPNO")
    Me.txtPPExp = .Fields("PPExp")
    Me.txtAgent = .Fields("Agent")
    Me.txtAddHome = .Fields("AddHome")
    Me.txtDateLast = .Fields("DateLast")
    Me.txtUserLast = .Fields("UserLast")
    End With
    
    Me.txtWPNO.Visible = True
    Me.txtWPNO.SetFocus
    Me.cmboWPNO.Visible = False
    Me.cmboWPNO = " "
    
End Sub


Would appreciate any help. I can't seem to find the full code anywhere
__________________
~Sharon~

Reply With Quote
  #2  
Old November 14th, 2005, 12:08 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 19 m 36 sec
Reputation Power: 181
Probably there is no CurrentDB() I think that's access specific.

My recommendation is you use this opportunity to leave DAO behind and use ADO instead.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #3  
Old November 21st, 2005, 05:58 AM
x_c4_4u x_c4_4u is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Zimbabwe
Posts: 34 x_c4_4u User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 10 m 15 sec
Reputation Power: 5
Send a message via Yahoo to x_c4_4u
doug's right

its time you stared using ADO
i used the following steps (using ADO)
-run an sql query just like the one you have
-load the results in the controls
==>if you have problems, i will send you sample code

Reply With Quote
  #4  
Old November 22nd, 2005, 10:19 AM
Sherrie Sherrie is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 155 Sherrie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 57 m 26 sec
Reputation Power: 5
Thanks Doug and x_c4_4u,

I am trying to use ADO, but I cannot figure out the syntaxes.

Would really appreciate if you could show me the sample code so that I can work backwards.

Thanks a bunch!


Reply With Quote
  #5  
Old November 22nd, 2005, 07:40 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 19 m 36 sec
Reputation Power: 181
You could start looking around here http://msdn.microsoft.com/library/e...adooverview.asp
Comments on this post
Sherrie agrees!

Reply With Quote
  #6  
Old November 22nd, 2005, 10:43 PM
Sherrie Sherrie is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 155 Sherrie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 57 m 26 sec
Reputation Power: 5
Thanks, Doug!

You're an angel!!!

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Unbound TextBoxes to Display Data From Access Tables


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT