Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I find out if a record exists?

Status
Not open for further replies.

modalman

Programmer
Feb 14, 2001
156
GB
Can anyone deliver me from this seemingly very simple problem? I have created a database application using Access and Form A needs to open either Form B or Form C depending on whether a particualr record exists or not. I have messed about with VB, RunSQL and DoCmd etc. I have also tried to create a recordset but it wont accept 'Dim dbs As Database' and 'Dim rs As Recordset'. I would really appreciate some guiding advice. Many thanks in advance.
 
First you descide on the criteria
What is it by the way???

then
in the "On_current" event of Form A
check for that value

like so

Private Sub Form_Current()
If Me!Textbox1 = "somevalue" Then
DoCmd.OpenForm "Form B"
ElseIf Me!Textbox1 = "someOthervalue" Then
DoCmd.OpenForm "Form C"
End If
End Sub

DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top