Setting Yes/No Value Through Code.

Jul 14, 2005

This has to be a simple solution for you gurus. I need to reset a CheckBox flag on a form after a business rule is carried out.

I noticed the check box gives the value -1 for Checked, and 0 for Unchecked.

So, when the box is checked, I want to clear it after carrying out a business rule. The code I tried doesn't work, it's as follows:

'Turn off WarehouseFlag after linking to Account
If Me.WarehouseFlag = -1 Then
Me.WarehouseFlag = 0
End If

How do I do this? It must be the fact the values are numbers, and the checkbox isn't a number field??

Thanks in advance!

Mike :cool:

View Replies


ADVERTISEMENT

Setting A Field Default Value Through Code

Dec 17, 2007

High all.

I would like to know how to set a fields default value on a table.

Eg - i have a Yes/No field that and i want the default value to be set to 'Yes'.

I cant use the front end application because the form its on is a generic form used by about 30 other tables.

At present it is not set to anything and so always defaults to 'No' on the form.

Thanks in advance.

View 6 Replies View Related

Setting Parameter To Query In VBA Code

Mar 16, 2008

Hello Friends,
I have Query1 that should get one parameter , how to set this parameter in a code.

Below the code.


Private Sub Command0_Click()

Dim MyDB As Database
Dim MyRS As Recordset
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim TheAddress As String

Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("Query1")
MyRS.MoveFirst

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
'
Do While Not MyRS.EOF

Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
TheAddress = MyRS![EmailName]

With objOutlookMsg
.To = TheAddress
.Display
End With

MyRS.MoveNext
Loop

Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub

View 2 Replies View Related

Setting Query Criteria In Code

Dec 13, 2007

I have a query that has 4 fields that are text fields in an external database. I have text boxes set up on a form which contain either null or >0 (depending on an option button selected). I want to pass that >0 to one field in the query and null to the other three. I have the following as criteria in my query:
[Forms]![frmSelectPayment]![txt2ndPayment] (same one for each of the 4 fields except the form field name changes)

Below is the code that sets the text boxes that are sent to the query:
Select Case [FraSelectPayment] 'depending on which pmt being pulled
Case 1 '6 payment plan only
stDocName = "qryGetPlusARImport"
Select Case [FraChoose]
Case 1
Me.txt2ndPayment = ">0"
Me.txt3rdPayment = Null
Me.txt5thPayment = Null
Me.txt6thPayment = Null
Case 2
Me.txt2ndPayment = Null
Me.txt3rdPayment = ">0"
Me.txt5thPayment = Null
Me.txt6thPayment = Null
Case 3
Me.txt2ndPayment = Null
Me.txt3rdPayment = Null
Me.txt5thPayment = ">0"
Me.txt6thPayment = Null
Case 4
Me.txt2ndPayment = Null
Me.txt3rdPayment = Null
Me.txt5thPayment = Null
Me.txt6thPayment = ">0"
Case Else
MsgBox "Please select a payment"
FraChoose.SetFocus
Exit Sub
End Select

DoCmd.OpenQuery stDocName, acNormal, acEdit


If I run the query alone I leave all fields blank and put >0 on the one I want to search by it works fine (695 records returned) but when I run it through code, nothing is returned. I really hope this makes sense to someone! Can anyone see what I am doing wrong?
Thanks

View 3 Replies View Related

Please Review This Code, (simple Code) New With Codes

Feb 16, 2006

Works great, but when I hit the number "3", (3 times in row) it will let me into the form. I want it to not let me in IF I don't know the password.

Where did I go wrong?

Private Sub Form_Load()
Dim pw As Variant

If InputBox("What is the password?", "Password") = "1" Then
Else
MsgBox "Invalid Password", vbCritical, "Sorry Charlie"
DoCmd.Close
If InputBox("What is the password?", "Password") = "2" Then
Else
MsgBox "Invalid Password", vbCritical, "Sorry Charlie"
DoCmd.Close
End If
End If


End Sub

View 14 Replies View Related

Using Code To Unprotect And Protect Viewing Code

Jan 14, 2007

I protect my code from people being able to read it by setting a password on the code from Tools > Properties, selecting the Protection tab and entering a password, and clicking "Lock Project"

Is there a way to write code that will remove that Lock Project check and check it back on?

I've looked through the Application.SetOption command and it doesn't seem to be one of the choices. It would be very helpful if someone knew how to do this.

Thanks

SHADOW

View 6 Replies View Related

Setting Up A New Db

Feb 15, 2007

Hi Guys,

ok I work a lot on databases but have recently been asked to set up an access database for my team. We are a marketing team within a large insurance company and need a small access database for MI and project management.

I have made a start on this and going well so far but there are some things I need it to do that I dont know how :P

Ive never messed about with Acess before so bare with me :P ok so this is what im looking for, any help would be greatly appreciated.

I have set up various tables for look up wizards for some of the menus on another table I designed for the raw data entry.

I need two tables, two forms - one table for very basic generic data such as

- Job Number
- Description
- Business Unit
- Owner
- Due Date
- Completion date

I then need to drill down into this to add more information, so its basically two tables on top of each other with co-dependencies.

So for example one of my team enter a new project at the very basic lvl, they have a job number, they know what business unit it is for and they know the date its due, as time goes by and work is done on the project I want them to be able to click on a button that takes them to another form where they can enter information that is linked to the original information.

So they search for job number 00000 and come up with the above data on the first form, I want them to then click on 'Project Information' button and be taken to another form that has a lot more stuff on there, like a description, complications, notes, links to documents etc etc. I tried to do this linking two tables together but it doesnt work as the two forms/tables are not co dependend and are irrespective of each other.

Does this make any sense ? and does anyone know how I might make this work ? Please let me know if I am not clear and I will try to explain as best I can

I would also like to change the form 'theme' aswell and have my companies logo transparent behind the data fields etc, anyone know how to do that as I only have the option to use the standard themes.

Any help would be greatly appreciated

Sleek

View 1 Replies View Related

F11 Setting

May 29, 2007

hi there,

Hiow can i make my access database to open the database window on pressing F11?

Thanks
Danny

View 14 Replies View Related

Setting References

Jun 22, 2005

Is it possible to set which VBA reference boxes are ticked each time a database is loaded?

A problem is created when a person amending the database to the person using it has different setups and so some of the references show as "missing" and so compile errors show on loading.

We are using Microsoft Access 97.

Any help most appreciated.

Dalien51

View 1 Replies View Related

Setting Out A Report

Apr 10, 2006

Hi

I have 6123 records in a database.

I need a report that prints the Customer ID and the Postcode

I have managed to do this but it comes to 196 pages!

Is there n e way i can format the report so instead of it being like this:-

Customer ID Postcode
2334 LS89 8UJ
2333 BD67 990

It displays multiple lines on each page .eg

Customer ID Postcode Customer ID Postcode
2334 LS89 8U 2354 LS69 8YH
2333 BD67 990 7899 BH78 6NQ

Can anyone help??

View 5 Replies View Related

Setting A Value To An Option Box

Apr 25, 2006

I made on option box on a form called Status. The 2 radio buttons are marked Open = 1 and Closed = 2. Is it possible to open a query based on what the user selects. In the query I want open to stand for Is Null and closed would be Is Not Null. I know this sounds unusual but it works in the query they way I want it to. Is this possible? Thanks...

View 2 Replies View Related

Setting AutoNumber

Jul 18, 2006

How do I change an AutoNumber that will output 1, 2, 3 to output 0001, 0002, 0003??


Thanks
Jessie

View 11 Replies View Related

Odd Problem...is It A Setting?

Feb 14, 2007

I tried various searched and came up empty handed.

I have a user that is using a database that is on a network. When she enters records using her computer and exists the database, they don't save. If she goes back in, they aren't there. However, if she uses another computer, they save.

I can assume that it's not user error because it's the same user on two different computers.

Any ideas?

View 7 Replies View Related

Setting Up Tables

Mar 4, 2007

I am confusing myself more and more as i read on normalization and queries and everything else. I am trying to create a database for parts that our company sells and am having trouble deciding how to lay out the tables. I figure I should use the part number for the primary key as it will not repeat. from there though, i have a problem, each type of part has different fields nessesscary to decribe its attributes. for example, one part number may be for a box and its describing fields might be brand, width, length,load rating, and height. but another part number might be for a circuit breaker which would have completley different describing fields like brand, amperage rating, voltage rating, connection type, and trip type. Should i create 1 table for everything even though many fields would be blank depending on which type of item it was or should i create seperate table for each type of item with only the required fields to decribe that item?

View 14 Replies View Related

Setting Subform

Jan 17, 2008

Hi,

i have a subform within a form. when the form is loaded, i would like the subform to automatically be ready for a new record instead of shown the last record entered. i have tried various macros ( not VB ) but to no avail. the form shows the persons info and needs you to add a certain piece of info. this would be the only reason for the form.

can it be done?


NS

View 1 Replies View Related

Setting Focus On Tab

Apr 11, 2008

Hi everyone,

how would i go about setting focus on a tab control? i have a tab control on a form with 6 tab pages. i am on page 4 ( bank ) and i have a button to add a bank account. this opens up the add form and i add the account. i then requery the form and the tab goes back to page 1. how do i set the focus back to the previous opened tab?

many thanks,


Nigel

View 2 Replies View Related

Help With Setting Up Tables

Apr 18, 2006

Dear all,

i have having such trouble setting up some tables in a new db, and am wondering if someone could give me some tips as I really don't know what I'm doing (I am new to this).

I have one main table, called Client Information. The PK is CaseNumber. I also have 11 other tables. The PK in each of these is called things like CasedetailsID, witnessinfoID, etc. Each of these tables contains the CaseNumber field (supposed to be from the Client Information table). The Client Information table contains the PK from each of the other tables.

The way I have the relationships set up at the moment is that the Client Information Table is linked to each of the other tables via the fields called casedetailsID, witnessinfoID, casetypeID, etc. The relationships are all one to many (the 'many' side being on the Client Info table, the 'one' side being on the related tables). There is obviously something incorrect about the way I have the tables set up, however, as when I try to enter data into the form, although the data gets stored in the individual tables, none of my queries or reports seem to be working (ie, I try to run a report, but it doesn't show any data).

any tips or advice regarding a good way to go about setting up tables and relationships would be very much appreciated.

View 3 Replies View Related

Help Setting Up A Database

May 11, 2007

17412 Hi, I am trying to set up a database for organizing Track and Field meets. I'm a newbie to a lot of the Access capabilities. I've attached a PDF of what I'm looking at doing for my Access tables. Some of the tables I think I have right. I don't know how to organize the meets, events, days. Should I have a table for each event? Can you look at my tables and give me advice on problems you can see? In the end I would like to enter the event results by race. Some races could have 10 or more heats. There are also field events that have different number of attempts depending on the meet. There are different track meets with different events each time and the order in which the events occur changes from meet to meet. Any help or advice you can give me would be great. Thanks!

CK

View 1 Replies View Related

Setting Up A Table

Nov 9, 2007

Hi

I feel really stupid for asking this, but I am so stressed at the moment, I can't concentrate!

I have a database that stores land locations and information relating to it. In the database, I need a form that asks 13 questions and answers are given in drop down boxes (about 3 answers to each question). Each of these answers relate to a score, which I want to be able to show automatically.

What I would like to know is how to set the table for it. This table has to use the ID from the land locations table (which is sorted by the way).

Please see the attachment for a simple design of what my 'boss' wants it to look like. The form for this table will be a subform on the main form for land locations.

Please can someone help me? I would really apreciate it :)

View 2 Replies View Related

Setting A Null Value To 0

Dec 16, 2005

hi

i've joined two tables and have some null values .....

I want these null values to be 0 to be used in a calculation

anyone got any ideas how i could do this

cheers

Andy

View 1 Replies View Related

Setting Realtionships

Feb 9, 2006

in a frontend/backend configuration is it necessary to set relationships in both or do relationships only need to be set in the backend file ?

thanks

View 1 Replies View Related

Setting Up A Query

Mar 27, 2006

Hi,
I have a table I am trying to set up a query. I got into the query and set up the fields as follows: Name, Address, Landlord, Lease Date, 90 Day Reminder, 30 Day followup.

I want to show all these columns in my query. I need to set up formulas for the 90 Day Reminder and the 30 day followup from the Lease Date field.
The 90 Day Reminder is the date 90 days prior to the Lease Date, and the 30 day followup is 30 days after the lease date.

I am having trouble setting up the formulas. I did it in design mode, and I tried filling in a formula and when I tried going into the dababase mode, it asks for for a parameter. I am having difficulty understanding what to fill in for the parameter. I am not sure about the formulas either.

Can someone help me???

Thanks,

Marilyn

View 1 Replies View Related

Setting RecordSource In VBA

Jan 26, 2005

This is driving me mad. I'm trying to copy a table and form from a template.
They both copy fine, but when I try to change the new forms recordsource property, nothing happens.

Private Sub CreateQuiz_Click()
'copy structure from existing BLANK table
a = InputBox("Name of new table", "Create new Quiz")
DoCmd.CopyObject , a, acTable, "BLANK"

DoCmd.OpenForm ("BLANK")
Forms!BLANK.RecordSource = a
Forms!BLANK.Close
DoCmd.CopyObject , a, acForm, "BLANK"
Forms!a.RecordSource = a

End Sub

Any help would be much appreciated.

View 1 Replies View Related

Setting RecordSource

Jan 27, 2005

Hi All
I have a Main Form, This Main Form has a Subform, the SourceObject for the subform is another form.
What I am trying to do is to set the RecordSource for the SourceObject Form from within the code behind the main form so i can use the same form with various queries.
Appreciate any help - thanks

View 2 Replies View Related

Setting A Title?

Mar 25, 2005

I know that you can change the title of your application in the startup options in Access.

But can it also be done by vba code at runtime?

View 1 Replies View Related

Setting A Default Value

Jun 17, 2005

Hi,
I'm trying to set a default value to field in a form. The field relates to Table 1 and I need a value from Table 2 as Default!
I've tried entering an SQL query:
Select Max(ID) From.... ;
But it doesn't work! Maybe It's just a question of syntax??
Thanx for your help.

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved