473,385 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

NotInList DblClick ERROR

Hi i have the following code in a CustomerID field if the user enters a
notinlist customer then they should dbl click to open the customer form
However this error occurs
"You tried to assign a null value to a varaible that is not a variant
type"

My code
Dim lngCustomerID As Long

If IsNull(Me![CustomerID]) Then
Me![CustomerID].Text = ""
Else
lngCustomerID = Me![CustomerID]
Me![CustomerID] = Null
End If
DoCmd.OpenForm "frmCustomer", , , , , acDialog, "GotoNew"
Me![CustomerID].Requery
If lngCustomerID <> 0 Then Me![CustomerID] = lngCustomerID

Exit_CustomerID_DblClick:
Exit Sub

Where have i gone wrong???
DD

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
5 1662
On 26 Jan 2004 04:59:08 GMT, David Deacon wrote:
Hi i have the following code in a CustomerID field if the user enters a
notinlist customer then they should dbl click to open the customer form
However this error occurs
"You tried to assign a null value to a varaible that is not a variant
type"

My code
Dim lngCustomerID As Long

If IsNull(Me![CustomerID]) Then
Me![CustomerID].Text = ""
Else
lngCustomerID = Me![CustomerID]
Me![CustomerID] = Null
End If
DoCmd.OpenForm "frmCustomer", , , , , acDialog, "GotoNew"
Me![CustomerID].Requery
If lngCustomerID <> 0 Then Me![CustomerID] = lngCustomerID

Exit_CustomerID_DblClick:
Exit Sub

Where have i gone wrong???
DD

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Have you tried stepping through to determine at what point the error
occurs? If not, it may not this piece of code that is causing it.
Also, is your example with in an event? Which one?

--
Mike Storr
veraccess.com
Nov 12 '05 #2
On 26 Jan 2004 04:59:08 GMT, David Deacon
<da**********@bigpond.com.au> wrote:

If the CustomerID field in the table is set to not allow nulls, the
line:
Me![CustomerID] = Null
may fail.

-Tom.

Hi i have the following code in a CustomerID field if the user enters a
notinlist customer then they should dbl click to open the customer form
However this error occurs
"You tried to assign a null value to a varaible that is not a variant
type"

My code
Dim lngCustomerID As Long

If IsNull(Me![CustomerID]) Then
Me![CustomerID].Text = ""
Else
lngCustomerID = Me![CustomerID]
Me![CustomerID] = Null
End If
DoCmd.OpenForm "frmCustomer", , , , , acDialog, "GotoNew"
Me![CustomerID].Requery
If lngCustomerID <> 0 Then Me![CustomerID] = lngCustomerID

Exit_CustomerID_DblClick:
Exit Sub

Where have i gone wrong???
DD

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 12 '05 #3
DD
Hi Mike
the code fails here
Else
lngCustomerID = Me![CustomerID]

This is a combobox, where you look up the the customerName it is the customerID
I am a bit lost on this
DD

Mike Storr <st******@sympatico.ca> wrote in message news:<a1****************************@40tude.net>.. . On 26 Jan 2004 04:59:08 GMT, David Deacon wrote:
Hi i have the following code in a CustomerID field if the user enters a
notinlist customer then they should dbl click to open the customer form
However this error occurs
"You tried to assign a null value to a varaible that is not a variant
type"

My code
Dim lngCustomerID As Long

If IsNull(Me![CustomerID]) Then
Me![CustomerID].Text = ""
Else
lngCustomerID = Me![CustomerID]
Me![CustomerID] = Null
End If
DoCmd.OpenForm "frmCustomer", , , , , acDialog, "GotoNew"
Me![CustomerID].Requery
If lngCustomerID <> 0 Then Me![CustomerID] = lngCustomerID

Exit_CustomerID_DblClick:
Exit Sub

Where have i gone wrong???
DD

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Have you tried stepping through to determine at what point the error
occurs? If not, it may not this piece of code that is causing it.
Also, is your example with in an event? Which one?

Nov 12 '05 #4
On 26 Jan 2004 12:30:02 -0800, DD wrote:

See below.
Hi Mike
the code fails here
Else
lngCustomerID = Me![CustomerID]


This is a combobox, where you look up the the customerName it is the customerID
I am a bit lost on this
DD

Mike Storr <st******@sympatico.ca> wrote in message news:<a1****************************@40tude.net>.. .
On 26 Jan 2004 04:59:08 GMT, David Deacon wrote:
Hi i have the following code in a CustomerID field if the user enters a
notinlist customer then they should dbl click to open the customer form
However this error occurs
"You tried to assign a null value to a varaible that is not a variant
type"

My code
Dim lngCustomerID As Long

If IsNull(Me![CustomerID]) Then
Me![CustomerID].Text = ""
Else
lngCustomerID = Me![CustomerID]
Me![CustomerID] = Null
End If
DoCmd.OpenForm "frmCustomer", , , , , acDialog, "GotoNew"
Me![CustomerID].Requery
If lngCustomerID <> 0 Then Me![CustomerID] = lngCustomerID

Exit_CustomerID_DblClick:
Exit Sub

Where have i gone wrong???
DD

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Have you tried stepping through to determine at what point the error
occurs? If not, it may not this piece of code that is causing it.
Also, is your example with in an event? Which one?


Is this being done in the NotInList or some other event that occurs prior
to the controls updating? If so, I think the problem is that the combobox
does not yet have a Value. I think it is not null because someone type
something into it, but a value has not yet been assigned to the bound
column because it does not yet exist.
If this is the NotInList event, then all the checking for nulls you are
doing is not really necessary, as something had to be entered in order for
the event to fire. Perhaps all you need to do is confirm that it is not an
empty string, and pass the new value (NewData argument) along to
frmCustomer using the OpenArgs portion of the DoCmd.OpenForm.

--
Mike Storr
veraccess.com
Nov 12 '05 #5
DD
Hi Mike

thanks for your input
I followed your idea of getting rid of the If Not IsNull and used
openArgs, all working great
thanks
DD
Mike Storr <st******@sympatico.ca> wrote in message news:<1f******************************@40tude.net> ...
On 26 Jan 2004 12:30:02 -0800, DD wrote:

See below.
Hi Mike
the code fails here
Else
lngCustomerID = Me![CustomerID]


This is a combobox, where you look up the the customerName it is the customerID
I am a bit lost on this
DD

Mike Storr <st******@sympatico.ca> wrote in message news:<a1****************************@40tude.net>.. .
On 26 Jan 2004 04:59:08 GMT, David Deacon wrote:

Hi i have the following code in a CustomerID field if the user enters a
notinlist customer then they should dbl click to open the customer form
However this error occurs
"You tried to assign a null value to a varaible that is not a variant
type"

My code
Dim lngCustomerID As Long

If IsNull(Me![CustomerID]) Then
Me![CustomerID].Text = ""
Else
lngCustomerID = Me![CustomerID]
Me![CustomerID] = Null
End If
DoCmd.OpenForm "frmCustomer", , , , , acDialog, "GotoNew"
Me![CustomerID].Requery
If lngCustomerID <> 0 Then Me![CustomerID] = lngCustomerID

Exit_CustomerID_DblClick:
Exit Sub

Where have i gone wrong???
DD

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Have you tried stepping through to determine at what point the error
occurs? If not, it may not this piece of code that is causing it.
Also, is your example with in an event? Which one?


Is this being done in the NotInList or some other event that occurs prior
to the controls updating? If so, I think the problem is that the combobox
does not yet have a Value. I think it is not null because someone type
something into it, but a value has not yet been assigned to the bound
column because it does not yet exist.
If this is the NotInList event, then all the checking for nulls you are
doing is not really necessary, as something had to be entered in order for
the event to fire. Perhaps all you need to do is confirm that it is not an
empty string, and pass the new value (NewData argument) along to
frmCustomer using the OpenArgs portion of the DoCmd.OpenForm.

Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Pieter Linden | last post by:
Just got done reading some of ADH2000 about comboboxes and the NotInList event... Doesn't look like it's possible to tweak the behavior of this so that I can have a non-text bound column, can I?...
1
by: Steve Leferve | last post by:
Can someone tell what what objects I have to work with on the 'NotInList' event? Basically I want to have a pop-up prompt the user if they want to add the data they typed into the database. ...
3
by: mal | last post by:
Sorry for repost - system added to another subject for some reason Have tried numerous ideas from the group to solve this one. It is such a simple example that it should be straightforward ! I...
2
by: whilstiwait | last post by:
I have a form containing a number of unbound combo boxes in three columns. Each column has boxes named "aaaa0", "aaaa1", etc. Using syntax like: With Forms(Me.Form.Name).Controls("txtTechnology"...
4
by: CAD Fiend | last post by:
Hello, I have a combo box (cmbFirstName) on a form that is hitting a query (qryFirstName) and then putting that selected (or typed by user) value to the table field (name FirstName) on the table...
7
by: Bryan | last post by:
I am trying to allow the user to add an item to a list if it is not found in a combobox. When the NotInList event is triggered I run a function "AddItem" that has a custom dialog box to add an...
2
FireMedic
by: FireMedic | last post by:
Hello all, I am creating an application that has an equipment inventory and maintenance form that has numerous subforms that are displayed depending on the category of equipment selected. I have...
4
by: EManning | last post by:
I have a combobox whose rowsource is a union query. This query displays a person's name in "lastname, firstname" format and in "firstname lastname" format. The query results look like this: ...
6
by: Volker Neurath | last post by:
Hi all, I have a Problem with combobox-property "NotInList" and an unbound Form. The situation: On my main form i have three comboboxes for data-exchange (here: Names of distributor,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.