Help w/ DLookup

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have a form for students to Sign In on. The Testing
proctor is able to select required fields by going into
an options form and select or deselect what they want
required on the Student Form.

The Options form is based of a table that as one record
with all the options.

Here is my problem I'm using Dlookup to see if the option
has been checked. If it has it requires the field and
displays a popup. If it hasent it just closes the form.

At first I had a Cmdbutton to close the form and put the
dlookup code in the form before update. That displayed a
error "You cancled previous Operation" That didnt work
so I put the code in On Click for the cmdbutton. This
also does not work. When the field is required it works,
but if it not the cmd button does nothing.

Here is the code

Private Sub SaveCmd_Click()
If (DLookup("TocOpt", "DbOptionsTbl")) = True Then

If IsNull(TOC) = True Then
MsgBox "Please Select the Type of Class YouAre In.",_
vbOKOnly + vbExclamation
TOC.SetFocus
Cancel = -1
DoCmd.close

If (DLookup("TocOpt", "DbOptionsTbl")) = False Then
DoCmd.close

End If
End If
End If
End Sub

Any help would be great
Thank You
David Ehrenreich
 
Hi David,

You state that

"I'm using Dlookup to see if the option has been checked."

Why are you not just checking the checkbox control's value? Example:

IF Me.CheckBox1 = True THEN
msgbox "it's checked"
ELSE
msgbox "it's not"
END IF

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."

This posting is provided "AS IS" with no warranties, and confers no rights

--------------------
| Content-Class: urn:content-classes:message
| From: <[email protected]>
| Sender: <[email protected]>
| Subject: Help w/ DLookup
| Date: Mon, 26 Jul 2004 11:41:32 -0700
| Lines: 45
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcRzQCvXReNrQmw/TGavLC2hrIVogw==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.access.formscoding
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.access.formscoding:240098
| NNTP-Posting-Host: tk2msftngxa11.phx.gbl 10.40.1.163
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| Hello,
|
| I have a form for students to Sign In on. The Testing
| proctor is able to select required fields by going into
| an options form and select or deselect what they want
| required on the Student Form.
|
| The Options form is based of a table that as one record
| with all the options.
|
| Here is my problem I'm using Dlookup to see if the option
| has been checked. If it has it requires the field and
| displays a popup. If it hasent it just closes the form.
|
| At first I had a Cmdbutton to close the form and put the
| dlookup code in the form before update. That displayed a
| error "You cancled previous Operation" That didnt work
| so I put the code in On Click for the cmdbutton. This
| also does not work. When the field is required it works,
| but if it not the cmd button does nothing.
|
| Here is the code
|
| Private Sub SaveCmd_Click()
| If (DLookup("TocOpt", "DbOptionsTbl")) = True Then
|
| If IsNull(TOC) = True Then
| MsgBox "Please Select the Type of Class YouAre In.",_
| vbOKOnly + vbExclamation
| TOC.SetFocus
| Cancel = -1
| DoCmd.close
|
| If (DLookup("TocOpt", "DbOptionsTbl")) = False Then
| DoCmd.close
|
| End If
| End If
| End If
| End Sub
|
| Any help would be great
| Thank You
| David Ehrenreich
|
|
 
Back
Top