Wrox Programmer Forums
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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


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

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.