From: Arvin Meyer [MVP] on
Actually it checks the length of the value. So change that line of code to:

If Me.[Check_Number] = 0 Then
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access
Co-author: "Access 2010 Solutions", published by Wiley


"Bardia" <Bardia(a)discussions.microsoft.com> wrote in message
news:EA1940B9-8B93-45CA-B509-2F72153374E8(a)microsoft.com...
> Thank you, now the problem is since Check Number control is format as
> Number
> field when I open the form zero (0) is already in that field and your
> procedure accepts that as check number and let me go to next new record
> and
> exit. Please advice.
> --
> Bardia
>
>
> "Arvin Meyer [MVP]" wrote:
>
>> Sub Form_BeforeUpdate(Cancel As Integer)
>> If Me.[Payment Type] = "Cash" Then
>> If Len(Me.[Check_Number ]& vbNullString) = 0 Then
>> MsgBox "You must enter a check number", vbOKOnly
>> Me.[Check Number].SetFocus
>> Cancel = True
>> End If
>> End If
>> End Sub
>> --
>> Arvin Meyer, MCP, MVP
>> http://www.datastrat.com
>> http://www.accessmvp.com
>> http://www.mvps.org/access
>> Co-author: "Access 2010 Solutions", published by Wiley
>>
>>
>> "Bardia" <Bardia(a)discussions.microsoft.com> wrote in message
>> news:9551E437-C820-453D-B97D-77D4240C7B07(a)microsoft.com...
>> > Access 2003 form with several controls including following:
>> > 1- Payment Type (combo box) that contain three entrees: CASH, Check,
>> > Credit
>> > Card
>> > 2- Check Number (text box)
>> > Question:
>> > What procedure or code I have to apply and to which event in property
>> > of
>> > Check Number Control that if user chose the Check in Payment Type combo
>> > box
>> > to be forced to enter a check number into Check Number control before
>> > record
>> > could be saved?
>> >
>> > --
>> > Bardia
>>
>>
>> .
>>


From: Bardia on
Thanks again, I replaced the line " If Len(Me.[Check_Number ]& vbNullString)
= 0 Then", with "If Me.[Check_Number] = 0 Then" as instructed but I have the
same problem. If I leave the zero(0) in the field it let me go to next
record, If I delete the zero then stops me and message emerge
--
Bardia


"Arvin Meyer [MVP]" wrote:

> Actually it checks the length of the value. So change that line of code to:
>
> If Me.[Check_Number] = 0 Then
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.accessmvp.com
> http://www.mvps.org/access
> Co-author: "Access 2010 Solutions", published by Wiley
>
>
> "Bardia" <Bardia(a)discussions.microsoft.com> wrote in message
> news:EA1940B9-8B93-45CA-B509-2F72153374E8(a)microsoft.com...
> > Thank you, now the problem is since Check Number control is format as
> > Number
> > field when I open the form zero (0) is already in that field and your
> > procedure accepts that as check number and let me go to next new record
> > and
> > exit. Please advice.
> > --
> > Bardia
> >
> >
> > "Arvin Meyer [MVP]" wrote:
> >
> >> Sub Form_BeforeUpdate(Cancel As Integer)
> >> If Me.[Payment Type] = "Cash" Then
> >> If Len(Me.[Check_Number ]& vbNullString) = 0 Then
> >> MsgBox "You must enter a check number", vbOKOnly
> >> Me.[Check Number].SetFocus
> >> Cancel = True
> >> End If
> >> End If
> >> End Sub
> >> --
> >> Arvin Meyer, MCP, MVP
> >> http://www.datastrat.com
> >> http://www.accessmvp.com
> >> http://www.mvps.org/access
> >> Co-author: "Access 2010 Solutions", published by Wiley
> >>
> >>
> >> "Bardia" <Bardia(a)discussions.microsoft.com> wrote in message
> >> news:9551E437-C820-453D-B97D-77D4240C7B07(a)microsoft.com...
> >> > Access 2003 form with several controls including following:
> >> > 1- Payment Type (combo box) that contain three entrees: CASH, Check,
> >> > Credit
> >> > Card
> >> > 2- Check Number (text box)
> >> > Question:
> >> > What procedure or code I have to apply and to which event in property
> >> > of
> >> > Check Number Control that if user chose the Check in Payment Type combo
> >> > box
> >> > to be forced to enter a check number into Check Number control before
> >> > record
> >> > could be saved?
> >> >
> >> > --
> >> > Bardia
> >>
> >>
> >> .
> >>
>
>
> .
>
From: Bardia on
Thank you problem is solved.
--
Bardia


"Arvin Meyer [MVP]" wrote:

> Actually it checks the length of the value. So change that line of code to:
>
> If Me.[Check_Number] = 0 Then
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.accessmvp.com
> http://www.mvps.org/access
> Co-author: "Access 2010 Solutions", published by Wiley
>
>
> "Bardia" <Bardia(a)discussions.microsoft.com> wrote in message
> news:EA1940B9-8B93-45CA-B509-2F72153374E8(a)microsoft.com...
> > Thank you, now the problem is since Check Number control is format as
> > Number
> > field when I open the form zero (0) is already in that field and your
> > procedure accepts that as check number and let me go to next new record
> > and
> > exit. Please advice.
> > --
> > Bardia
> >
> >
> > "Arvin Meyer [MVP]" wrote:
> >
> >> Sub Form_BeforeUpdate(Cancel As Integer)
> >> If Me.[Payment Type] = "Cash" Then
> >> If Len(Me.[Check_Number ]& vbNullString) = 0 Then
> >> MsgBox "You must enter a check number", vbOKOnly
> >> Me.[Check Number].SetFocus
> >> Cancel = True
> >> End If
> >> End If
> >> End Sub
> >> --
> >> Arvin Meyer, MCP, MVP
> >> http://www.datastrat.com
> >> http://www.accessmvp.com
> >> http://www.mvps.org/access
> >> Co-author: "Access 2010 Solutions", published by Wiley
> >>
> >>
> >> "Bardia" <Bardia(a)discussions.microsoft.com> wrote in message
> >> news:9551E437-C820-453D-B97D-77D4240C7B07(a)microsoft.com...
> >> > Access 2003 form with several controls including following:
> >> > 1- Payment Type (combo box) that contain three entrees: CASH, Check,
> >> > Credit
> >> > Card
> >> > 2- Check Number (text box)
> >> > Question:
> >> > What procedure or code I have to apply and to which event in property
> >> > of
> >> > Check Number Control that if user chose the Check in Payment Type combo
> >> > box
> >> > to be forced to enter a check number into Check Number control before
> >> > record
> >> > could be saved?
> >> >
> >> > --
> >> > Bardia
> >>
> >>
> >> .
> >>
>
>
> .
>