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
You are currently viewing the BOOK: Access 2003 VBA Programmer's Reference section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
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