Testing For Null Fails

Oct 19, 2004

I have a table where some of the values of MyField are null.

I am creating a function that depends on the value of Myfield which I pass to a variable varMyField and am testing it with If IsNull(varMyVariable) but it errors. Have tried setting the variable as a variant but no difference.

Function Test(varMyField as variant)

If isnull(varMyField) then
Dosomething,
Else
Dosomething Else
End if

End function

Any suggestions please?

View Replies


ADVERTISEMENT

Testing For Null

May 2, 2008

I know this is an easy one but have to ask...I am trying to test wether or not a Textbox in my form is Null or not...

Cant get it to work

Thoughts?


Code:If Text45 = "" Then MsgBox "45"Else MsgBox "THERE IS SOMETHING"End If

View 4 Replies View Related

Modules & VBA :: Testing Combo Box Null Value

Sep 22, 2013

Windows vista
Access 2007

I can't seem to figure out how to test a combo box null value.I try:

Code:
If IsNull(Me.cboManufacturer) Then
MsgBox ("Please select category")
Else
DoCmd.OpenReport "rptItemCategory", acViewPreview
End If

This works if the combo box IS NOT NULL, but if null it gives me:

PHP Code:

Run-time error '3071': This expression is typed incorrectly, or it is too complex to be evaluated. 
For example, a numeric expression may contain too many complicated elements. 
Try simplifying the expression by assigning parts of the expression to variables. 

I then tried:

Code:
If IsNull(Me.cboManufacturer.Column(0)) Then
MsgBox ("Please select category")
Else
DoCmd.OpenReport "rptItemCategory", acViewPreview
End If

This works if the combo box IS NULL but if i've made a selection, it still gives me the message box as if I've selected nothing....

View 1 Replies View Related

Modules & VBA :: Testing A Field In Table For Null Within IF Statement

Aug 30, 2013

I have a form with two list boxes on it: listAllBANANA and listActiveBANANA

The listboxes are populated from tblBANANA. Active is defined by the tblBANANA field "ResponseDate" being Null.

Also on the form is a CloseBANANA command button. When pressed with no selection, it opens frmCloseBANANA to the first record. If a BANANA is selected in listActiveBANANA, the form opens to the selected record.

Now comes the tricky part: if a BANANA is selected in listAllBANANA, I first need to verify they have an Active BANANA selected, before opening the form. I've poked and tested and searched and cut and pasted my little fingers off with no joy. What I've deduced is that I'm either messing up the syntax of the DLookup or I'm incorrectly referencing the selected record. There's also the third option that I'm going about this in entirely the wrong way.

All other code below works. If I delete or comment out the line in red, I have no issues other than I may open up a blank form because I'm trying to close a BANANA that is already closed.

Code:
'If a BANANA is selected in Active BANANA or All BANANA, open Close BANANA to that record. If not, open form to most recent record
Private Sub cmdCloseBANANA_Click()
If Not IsNull(Forms!frmGUI!listActiveBANANA) Then

[Code] .....

View 8 Replies View Related

Testing

Oct 9, 2004

hi is this working yert?

View 1 Replies View Related

Testing For A Sunday?

Feb 22, 2008

Hello peeps,
I have been working on a hours checking application, in which the user can enter their worked hours for the week and the application calculates how many hours at normal rate , time and half rate or double time rate have been worked for the week. All has been going swimmingly, with some help from here of course :)

What I would like to achieve now however, is, testing for a Sunday. This is because all hours worked on a Sunday, is paid at double time, regardless of the previous hours already worked for that week.

Example if a person worked 60 hours in a given week, there would be 47.5 hours of normal rate, 7.5 hours of time and a half rate and the remaining 5 hours would be at double time rate. But, if a person worked 60 hours in a week and 10 of those hours are worked on a Sunday, this would mean 47.5 at normal rate, only 2.5 hours at time and half rate and the remaining 10 hours at double time.

Therefore, is there a way I can test for a Sunday and perhaps automatically set a flag for the overtime calculation? Or is it possible with DateDiff() function, and if so could someone please assist me with the syntax or at least point me in a direction where I could solve this?

All replies gratefully recieved. Thanks in advance to anyone taking the time to read this post.

View 6 Replies View Related

New Record, Testing For

Jun 11, 2005

I need to disable a custom goto next record button. How do I find out if the current record is both the last and new or if a new record is possible?

Many thanks in advance,

Aidan

View 4 Replies View Related

Switchboard Fails In ADP

Jun 14, 2004

After I upsized by Access app to an ADP, the switchboard refuses to compile. When I click any command button, I get an error saying: Method or Data member not found. The error is at the reference to me.switchboardID in the HandleButtonClick procedure. That field is somehow hidden or is programatically created or something. I have tried to import a very simple switchboard from another mdb app with the same results. Something is going on behind the scene's and I can't figure it out. Anybody got any answers?

Thanks in advance.

View 2 Replies View Related

Core Testing Database

Sep 1, 2005

Hi,

I hope someone can help me. Thanks ahead for taking the time to read through my post.

I am new to Access (I know the basics,) and will ask my question by hand of describing what I want to do with my database.

I work as a laboratory technician, where I need to test UTP cores (cores are what's called one of the 8 cables inside a UTP/Network cable.) I want to create a database where I can store these test results.

To make it easier to envision my database, I'll explain a bit about the actual testing. Cores are grouped together, and tested, according to batches. There are 40 cores in a batch. Each core has a unique job number. Further, the cores are divided into 8 different colors (Green, W/Green, Orange, W/Orange, Brown, W/Brown, Blue, W/Blue.)

A standard test procedure is done on EACH core: dimensions on the insulation on a X and Y axis; dimensions on the copper on a X and Y axis; a test to determine if the copper sits centre. There are thus 5 values I want to record.

My problem is: I want all 40 cores, each with their 5 values, on one form. I want to save this as one batch, or one record. How would I go about doing this? . It’s a bit more complex than your standard table-query-form-report database.


As I said, I am acquainted with the basics of Access. I can do tables, queries, forms and reports.

Thanks ahead.

View 3 Replies View Related

Before Update Save Fails

Sep 9, 2005

Hi, i am trying to perform a beforeupdate event on a record, but seem to be getting an error.

The undo function works fine but it cannot save, i would be grateful if someone can help as the error is unclear.

Code:

Private Sub Form_BeforeUpdate(Cancel As Integer)

If MsgBox("Are you sure you want save these changes?", vbQuestion + vbYesNo) = vbYes Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Else 'user clicked no
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End If

End Sub



Error that i am getting.....

Run-time error '2115'

The Macro or function set to the beforeUpdate or ValidatationRule propety fot this field is preventing from saving the data in the field.

Thanks

View 1 Replies View Related

Duplicate Button Fails Me

Sep 23, 2005

Dear friends,

At work, we are developing a database in MS Access to manage the data originating from the archaeological site which we are excavating at the moment. The development work is proceeding rather well considering that none of us has a background in database programming. However, sometimes we get stuck on problems that we seem unable to resolve by ourselves.

For example, recently we encountered a situation which baffles us completely.

Background: Last week we develloped the table and form necessary to handle the decorations present on some of the finds. The "decoration table" is linked to the "finds table" with a one-to-many relationship. They are linked by two secondary key fields called "FindID". They are text fields, size 19, with the following input mask set: LL"."LL"."00?00000?-000. This code automatically appears in the appropriate field of the "decoration form" every time we need to relate a decoration to the record in the "finds table".

Problem: At this point we have a record in the "decoration form/table" related to a record in the "finds form/table". However, sometimes we have more than one decoration present on a find. Thus, we place a duplicate button in the former form to add a second decoration if necessary. This should create an exact copy of the first "decoration form" where, then, we just need to change the type of decoration. This does not happen. The duplicate button creates a second copy of the first form, but it does not duplicate correctly the value present in the "FindID" field. For example: instead of duplicate the "findID" RM.PL05 00534A-001 it inserts it in the duplicated form like RM.PL0500534A-001 (without the space between the 5 and the 0). Thus when we query that particular find, it retrieves only one of the two decorations we inserted earlier on.
One last thing: The code looks the same in both decoration forms, but if I do a query, the above difference appears.
Thanks in advance for your help

Perseo

View 1 Replies View Related

Subform Requery Fails

Sep 26, 2006

I have used the following command on a command button to requery my subform and it works as I planned. However, if I copy it to say,the OpenEvent for the same form, nothing happens. I'm obviously missing something here. [Forms]![Customers]![mysubform].Form.Requery

All help appreciated thanks

View 3 Replies View Related

Tables :: AutoNum While Testing

Feb 6, 2013

I created a table and a form. One of my tables fields is AutoNum. Each time I test the form layout, the AutoNum field increase and yet I am only testing at this stage!How can I bring back this field to zero? Where is my data stored (extension)?

View 1 Replies View Related

General :: Testing Folder For A Value

Aug 1, 2013

This code below works, but alot of what it does is unnecessary. I have a directory structure named 1000-2000, 2001-3000, 3001 - 4000 etc and within that is the individual folders 1000, 1001, 1002 etc

How do I test to search top level folder thats no larger than correctNum to then test the subfolder for correctNum? I've looked at instr and a few other funtions, but can't find a solution. Below is what I have now, it works but I know it searches everything and that's not correct

Dim filesys
Dim Subdir
Dim folder
Set filesys = CreateObject("Scripting.FileSystemObject")
Dim oDir
Dim bDir
CorrectNum = Serial.Value

[Code] ....

View 3 Replies View Related

Form Fails To Update Table

Apr 19, 2005

I have a form which has a table as it's Record Source. The problem lies when a bound combobox or bound textbox is changed, the change is noted on the form but when I reference the value of the object it comes back as null. So I look in the table and the field has not changed. But if I requery the form then it takes.

I've never had this happen to me before, is there something I am missing? :confused:

View 3 Replies View Related

Logic Testing For Incremental Numbers

Jan 7, 2005

I need some help with code. I can do this in Excel, but I am not sure how to do it in Access.

Here are the fields:

PoundsPerBox
PoundsPerOrder
BoxesToOrder

Here is the scenario: If a customer orders custom paint for their equipment, we need to total how many pounds of Powder Coat paint it takes to paint all the units (PoundsPerOrder). When we order this from the vendor we have to order it by the box which is measured in pounds. In this example, the vendor will sell us a box of white Poweder Coat paint in increments of 55 pounds. (55, 110, 165,...)

Verbally, the logic reads like this: If PoundsPerOrder is less than or equal to PoundsPerBox, then BoxesToOrder equals 1. This logic needs to be tested for each increment value (indefinately) of PoundsPerBox.

Am I making sense? How do I accomplish this in Access? And, as a side note, I need to capture and store this value in a table for future reference.

View 7 Replies View Related

Displaying Data - Whle Testing -

Oct 18, 2006

I know this is really silly.
How do I display data that I am working with in a report? I want to do the equivalent of alert or response.write. I am using msgbox, but it's getting old. What is the syntax for just displaying it ? Can I do that on a form? I tried using document.write, but it didnt like it. thanks-

View 1 Replies View Related

Forms :: Testing Subform Conditions

Sep 25, 2014

I do not want to allow the main form record to be submitted unless there is at least one subform entry.Initially I thought it would be as simple as a "Before Update" event which would test the record count of the subform. This works... kind of... not really. It does check successfully, however the conundrum is that if the user has completed the main form and tries clicking INTO the subform to add records, this fires the Before Update event and Cancels the update event.

How can I force a user to complete the subform without running into this issue? I dunno how easy this is to do considering you kind of HAVE to exit the main form to enter the subform, at which point the record HAS to be saved...

View 1 Replies View Related

Modules & VBA :: CreateObject Fails In Runtime

May 19, 2015

I am using Access 2010 on Windows XP/Windows 7 My code converts individual lines of address (strings) into a single RTF Address field. It runs fine in full access but (as MS admits) CreateObject does not work in Runtime. Is there another way of doing this that avoids CreateObject??

'create AddressFull
strAddressFull = ""
If Nz(mAddress1, "") <> "" Then strAddressFull = mAddress1
If Nz(mAddress2, "") <> "" Then strAddressFull = strAddressFull & Chr(10) & mAddress2

[Code]....

View 4 Replies View Related

Modules & VBA :: Testing For Out Of Context Errors

Apr 9, 2014

I have quite a simple function. I am calling it in a query (through the Build window) like this:

Code : AbsMag: getAbsoluteMagnitude([Tbl]![m],[Tbl]![Distance])

When the input value for m is empty/Null, the response returned in the query is #Error. Problem is, any way I try to test for this in the function, it still returns #Error.The Watch for m reads "<Out of Context>" for these errors. Anyway to test/trap for this within the function itself?

Code:
Public Function getAbsoluteMagnitude(m As Double, d As Double, Optional dUnit As String = "Mpc") As Double
Dim absoluteMag As Double
' IsError(m) returns False
' IsNull(m) returns False
' IsEmpty(m) returns False

[code]...

View 3 Replies View Related

General :: Testing Value Of Multiple Fields

Apr 6, 2014

I actually have about 13 separate fields in a table I'm trying to summarize in a single report field. Each field corresponds to a particular action taken. If the action was taken the field value is 1, if the action was NOT taken the field value is 0. The report needs to contain a single field that lists all actions taken. I tried doing this with an If statement formula on the report, but it does not work.

=(IIf([ACTION_VQ_SCAN]=1,"VQ Scan")) And (IIf([ACTION_OTHER]=1,[ACTION_OTHER_SPEC])) And (IIf([ACTION_CULTURE]=1,"Culture(s)")) And (IIf([ACTION_DRUG_THERAPY]=1,"Drug Theraphy"))........ and so on

It looks like it expects all if statements to be true, thus the formula does not return anything. Usually only 1 or 2 actions are actually taken, but I need to account for the possibility of any and all combination of actions.

View 3 Replies View Related

General :: Saving PDF - Testing To See If Directory Exists

May 31, 2013

I'm starting to automatically save PDF copies of certain reports in predetermined locations. I need to copy a file to a particular directory (based upon various criteria), but if the directory does not exist, I want to create the directory on the fly first. Otherwise I will just proceed with the copy.

I'm sure there is a DOS command to do this, but I can't find it.

View 5 Replies View Related

Forms :: Delete Record Fails To Work

Mar 28, 2013

I'm very new to Access, Macros, and VBA. Basically I have a form in ContinuousForm format that has a delete button next to each record. It's been working fine for the past few hours but for some reason Access can't delete the corresponding record(s) (DeleteRecord) now. The button is run by a macro that's made by a wizard.

Also, is there an appropriate way to show code (if that is the term used) for Macros?

View 2 Replies View Related

Access Database Fails When Using Task Scheduler

May 1, 2013

I have an Access database that sends an email to users when there is an exception in the query. It works fine when I run it from Windows 7, but when I use task scheduler I get an error message;

Runtime error 429 activex component can't create object

and the error stops a;

Set olapp = New Outlook.Application

It only happens when i run it from Task Scheduler.

View 14 Replies View Related

Beta-testing A Database While Making Improvements?

Jul 23, 2015

I need to start using the database I've created (desktop database). However, I don't want my current version to be the final version.

Should I create another file to work in and use the old version for data entry? When I am ready to start using my new version, is it easy enough to transfer all the data from the old?

View 3 Replies View Related

ACCDE Fails To Load VBA On Random Workstations

Jan 14, 2014

I have created a database to track leave requests for staff. After upgrading from XP to Win7 and upgrading to Access 2010, some workstations will not run the ACCDE front end, but the ACCDB runs fine.

I am storing the front end ACCDE in C:Users\%username%appdataRoaming which is trusted - and I do not receive a warning for this. When the ACCDE loads I receive the message that "The database cannot be opened because the VBA project contained in it cannot be read.". I have tried running the application with different users to eliminate privilege issues. All the workstations are built from the same image and I cannot find any missing references or different patches. The workstations in question are running RUNTIME version.

I have checked for missing references in the dev version. I have compiled the database right before creating the ACCDE, finally I have run the app with the -DECOMPILE option.

View 3 Replies View Related







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