Article View: pl.comp.bazy-danych.msaccess
Article #137013Re: Poprawność funkcji opartej na IF
From: Zbigniew Bratko
Date: Thu, 01 Oct 2015 16:50
Date: Thu, 01 Oct 2015 16:50
49 lines
1818 bytes
1818 bytes
W dniu 2015-09-29 o 19:25, MaciejF pisze:
> Co sądzicie o poniższej funkcji?
>
> Function PROJST(vK, Optional vNumer) As String
>
> If IsNull(vK) Then
> PROJST = "Brak"
> ElseIf vK = 4 Then
> PROJST = "Standard"
> ElseIf vK = 0 Then
> If Left(vNumer, 2) = "ZS" Then
> PROJST = "Standard"
> Else
> PROJST = "Projekt"
> End If
> Else
> PROJST = "Projekt"
> End If
>
> End Function
>
Nie wiadomo, co ma zwrócić funkcja PROJST
Np. dla vK=0
MsgBox PROJST(0)
U mnie Access w linii
...
If Left(vNumer, 2) = "ZS" Then
zgłasza błąd nr 13:
Type mismatch.
Przed zastosowaniem funkcji Left proponuję sprawdzić, czy argument
vNumer został przekazany:
If Not IsMissing(vNumer) Then
If Left(vNumer, 2) = "ZS" Then
--
Pozdrowienia
BraZby
www.faq.accdb.pl/
www.acc97.accdb.pl/
Technical Details
Message-ID:
<mujo8t$rvj$1@node2.news.atman.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mailReferences:
<fa6a276a-9ade-4f0d-9df4-b8f0971918f5@googlegroups.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail From: Zbigniew Bratko <access@beztegoaccdb.pl> Newsgroups: pl.comp.bazy-danych.msaccess Subject: Re: Poprawność funkcji opartej na IF Date: Thu, 1 Oct 2015 18:50:08 +0200 Organization: ATMAN - ATM S.A. Lines: 49 Message-ID: <mujo8t$rvj$1@node2.news.atman.pl> References: <fa6a276a-9ade-4f0d-9df4-b8f0971918f5@googlegroups.com> NNTP-Posting-Host: 5.172.239.202 Mime-Version: 1.0 X-Trace: node2.news.atman.pl 1443718237 28659 5.172.239.202 (1 Oct 2015 16:50:37 GMT) X-Complaints-To: usenet@atman.pl NNTP-Posting-Date: Thu, 1 Oct 2015 16:50:37 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: <fa6a276a-9ade-4f0d-9df4-b8f0971918f5@googlegroups.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit