Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 15th, 2013, 02:37 PM
tytus07@gmx.com tytus07@gmx.com is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 2 tytus07@gmx.com User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 5 m 35 sec
Reputation Power: 0
Question Problem with VB access 2010 script

Hi
I created VB script under Access 2010 to look up for record in two different forms, and when is a match, then open correct form with specific record present, also if record was not found it should show message, but is not working. It looks like my "IF" statement is wrong.
Can you help me find what is wrong?
Thnak you
Tytus

**************
Private Sub Command22_Click()


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "CHANGE_CONTROL_DOCUMENTS"

If (stLinkCriteria = "[Document ID]=" & "'" & Me![Document_type] & "'") <> 0 Then

DoCmd.OpenForm stDocName, , , stLinkCriteria
Else

MsgBox "The Document does not exist!", vbCritical

End If


End Sub
***************

Reply With Quote
  #2  
Old February 20th, 2013, 02:36 PM
tytus07@gmx.com tytus07@gmx.com is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 2 tytus07@gmx.com User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 5 m 35 sec
Reputation Power: 0
Question

Hi
I was able to fix some stuff in my script, so is looking correctly for records in two differnet forms, only one thing is still not good that when there is no record to match, is not displaying my message.
Any advice?
#
Dim stDocName As String
Dim stLinkCriteria As String
Dim stDocNameF As String
Dim stDocNameALL As String
Dim CDWM As String
Dim Base As String
Dim i As String

stDocName = "DOC-1"
stDocNameF = "DOC-2"
Str1 = "CDWM"
Str2 = "Base"
stLinkCriteria = "[Document ID]=" & "'" & Me![Document_type] & "'"

If InStr(stLinkCriteria, Str1) > 0 Then

DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
If InStr(stLinkCriteria, Str2) > 0 Then

DoCmd.OpenForm stDocNameF, , , stLinkCriteria
Else
MsgBox "The directory already exist!", vbCritical
End If
End If
#

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Problem with VB access 2010 script

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap