Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > BOOK: Access 2003 VBA Programmer's Reference
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Access 2003 VBA Programmer's Reference
This is the forum to discuss the Wrox book Access 2003 VBA Programmer's Reference by Patricia Cardoza, Teresa Hennig, Graham Seach, Armen Stein; ISBN: 9780764559037
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Access 2003 VBA Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 25th, 2009, 01:06 PM
Registered User
 
Join Date: Sep 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Access getting data via VBA from SQL Server 2008

I am creatiing a data entry form in Access that wites data to an Access table. I need to be able to get one field from a master file on SQL Server call Mast_ID. In the data entry form I need to verify that the Mast_ID Just entered in data entry has a correspond Mast_ID on SQL Server. I have two linked tables to SQL Server in my Access .mbd that run queries very well using ODBC and the QBE grid. I am using the following VBA code code

'Set up select query
Dim cnnluid As ADODB.Connection
Set cnnluid = CurrentProject.Connection
Dim MaMIDRecordSet As New ADODB.Recordset
MaMIDRecordSet.ActiveConnection = cnnluid
'Add SQL to string for looking up Master_ID in
'Master Accounts Table on Server
Dim StrLUMID As String
StrLUMID = "SELECT dbo_Master_Accounts.Master_ID FROM"
StrLUMID = StrLUMID + " dbo_Master_Accounts"
StrLUMID = StrLUMID + " WHERE (((dbo_Master_Accounts.Master_ID)='Card_No'))"
'Run Select query with String containing SQL
MaMIDRecordSet.Open StrLUMID

The system tells me that "ODBC Call failed"

Hope you can be of help.

Thanks in advance

jpl458
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HOW do you create a Login screen Using C#2008 textboxes to verify SQL SERVER DATA Silvercreek C# 2008 aka C# 3.0 2 April 6th, 2011 07:38 AM
Data Access with SQL Server Mobile column two SQL Server 2005 0 January 24th, 2009 06:29 PM
SQL Server 2K, Access 2003 and VBA SteveBH SQL Server 2000 1 January 11th, 2007 01:23 PM
Access to Sql Server data export mateenmohd SQL Server 2000 4 February 14th, 2006 02:18 PM
Using Access with SQL Server Data npepin Access 4 July 21st, 2004 03:36 PM



All times are GMT -4. The time now is 04:07 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.