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 "frmCustome r", , , , , 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! 5 1673
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 "frmCustome r", , , , , 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
On 26 Jan 2004 04:59:08 GMT, David Deacon
<da**********@b igpond.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 "frmCustome r", , , , , acDialog, "GotoNew" Me![CustomerID].Requery If lngCustomerID <> 0 Then Me![CustomerID] = lngCustomerID
Exit_CustomerI D_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!
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******@sympa tico.ca> wrote in message news:<a1******* *************** ******@40tude.n et>... 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 "frmCustome r", , , , , 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?
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******@sympa tico.ca> wrote in message news:<a1******* *************** ******@40tude.n et>... 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 "frmCustome r", , , , , 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
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******@sympa tico.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******@sympa tico.ca> wrote in message news:<a1******* *************** ******@40tude.n et>... 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 "frmCustome r", , , , , 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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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?
Say I have a Customers--Invoices relationship, and I want to be able
to pick the Customer's name from a combobox. (keeps people from
entering the same text - or worse, just almost the same - a zillion
times). So I create a CustomerID, enforce...
|
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.
Steve Lefevre
|
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 just want to
add a new item to a combo that has data from a file, by typing in the
new value , adding to the file and the requerying to get the new valus
in the list. i.e. a data entry and data display combo box.
I select an item from cmb1 and...
|
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" & i)
.AfterUpdate = "=txtTechnology_Change(" & i & ")"
.OnEnter = "=txtTechnology_OnEnter(" & i & ")"
End With
I can set events to a common routine for all the boxes, and in the
|
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 (tblUserInfo).
The query hits a look up table called (lulFirstNames). If the user
DOESN'T find the name they want in the combo box, they will just type it
in.
| |
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 item to the
underlying table. The function either returns "Not Added", or the new
Items ID. I know the function works fine. Whe I try the code below I
get errors saying "Close action was cancelled" (referring to my custom
popup input box), & ...
|
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 two common combo boxes on each subform - "Supplier" and "Manufacturer". I use the following code for the "NotInList" event and it works fine. (This is the version for the "Supplier" cbo)
Public Sub cboSupplier_NotInList(NewData As String,...
|
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:
Mouse, Mickey
Mickey Mouse
When a person is added, the querys' underlying recordset is updated in
the NotInList event. I can't figure out how to refresh the combobox
to display the new person. I get the standard error message that the
|
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, reseller and final customers, the whole database is made
for storing information about quotatations - no, not for quoting itself)
ut the boxes actually may not contain all our distributors and reseller's
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |