User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 402,375 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,051 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 1230 | Replies: 0
Reply
Join Date: Oct 2006
Posts: 4
Reputation: elainenguyen is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
elainenguyen elainenguyen is offline Offline
Newbie Poster

Help Searching a record in 3 tables

  #1  
Oct 5th, 2006
I am doing Acess database with VBA.
I have 3 tables (you can look at the code below). The codes works when searching for records that are exist in the tables. But when I try a record that doesn't exist in the table, I din't get the warning message that I want. Not sure what happen, I didn't see anything wrong with the code.
Thanks alot!
Elaine

Elaine Nguyen's code:
Dim db As Database
Dim rst As Recordset
Dim stLinkCriteria As String

'Open form and carry account number over first
stLinkCriteria = "[CVACCTNO]=" & Me![txtAcctNo]
DoCmd.OpenForm "frmCerner", , , stLinkCriteria
[Forms]![frmCerner]![txtPtName] = Me.txtPtName

'Find if record is exit. Find from beginning of recordset to ending of recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("tblCernerMicro", dbOpenDynaset)
rst.FindFirst "[FNBR] = " & Me![CVACCTNO] & ""
If rst.NoMatch Then
Else
Set rst = db.OpenRecordset("tblCernerSuscept", dbOpenDynaset)
rst.FindFirst "[FNBR] = " & Me![CVACCTNO] & ""
If rst.NoMatch Then
Else
Set rst = db.OpenRecordset("tblCernerUA", dbOpenDynaset)
rst.FindFirst "[FNBR] = " & Me![CVACCTNO] & ""
If rst.NoMatch Then
MsgBox "No Cerner record was found under this account number: " & CVACCTNO & "", vbOKOnly, "No Record On File"
DoCmd.Close acForm, "frmCerner", acSaveNo
Else
stLinkCriteria = "[CVACCTNO]=" & Me![txtAcctNo]
DoCmd.OpenForm "frmCerner", , , stLinkCriteria
[Forms]![frmCerner]![txtPtName] = Me.txtPtName
End If
End If
End If
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 12:43 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC