Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 7th, 2003, 03:31 AM
Authorized User
 
Join Date: Oct 2003
Location: , , .
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default checkbox

hi

how can i do checking (if else) under the control source properties of a field?


pls advice???:)


  #2 (permalink)  
Old October 7th, 2003, 05:23 AM
Authorized User
 
Join Date: Sep 2003
Location: Cambridge, , United Kingdom.
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I not entirely sure if this is what you are asking (Tell me if I am wrong) however if I need to isolate the contents of a field for checking purposes I usually use
Code:
if me.fieldname= "Yourinfohere" then ...
in the Form_Current() method. This will isolate the context of the textbox/combobox being used. For check boxes use true/false as necessary.

Below are a couple of examples
<h3>example 1</h3>
Code:
If Me.Loggedin_txt = "Usernamehere" Then
    'If so then allow new users button
    Me.NewUser_btn.Visible = True
    Me.NewUser_lbl.Visible = True
End If
<h3> Example 2 checkboxes</h3>
Code:
If recClone.RecordCount = 0 Then
    MsgBox "There is no one to be billed this month"
    DoCmd.Close
Else
    'If to see if the URL expiry is within next month, add to bill.
    If Me.NextRenewel_URL <= Date + 31 Then
        BillTotal = Me.CostPA
    Else
        BillTotal = 0
    End If
'more code here
End If
Alright it's crude, probably not the most efficient way of doing things, but it works. If anyone else reading this knows more efficient ways of checking data, please let me know.

If however you want to edit control source based on the contents of a text box try this (Once again crude, and almost certainly not totally efficient)
Code:
If Me.ClientName = "fhjk" Then
   Me.Text1.ControlSource = "= DomainName" 'Due to fact its a text field
Else
   Me.Text1.ControlSource = "=" & ExtentionNumber 'not text field therefore no need
                                                  'for "..."
End If
HTH

---
David Thorne, Student
UK
  #3 (permalink)  
Old October 10th, 2003, 03:25 AM
Authorized User
 
Join Date: Oct 2003
Location: , , .
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

okie thanks!!



Similar Threads
Thread Thread Starter Forum Replies Last Post
checkbox grstad HTML Code Clinic 1 December 18th, 2006 08:10 AM
checkbox checked by default by html:checkbox sachin.tathod Struts 3 December 4th, 2006 03:41 PM
Need Help regards checkbox nellaikumar ASP.NET 1.0 and 1.1 Basics 1 December 1st, 2005 02:07 PM
checkbox fcm Access VBA 12 April 15th, 2005 08:15 AM
Checkbox johnjohn Classic ASP Basics 2 December 6th, 2004 06:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.