NotInList - Still Getting Standard Message

Apr 10, 2005

I have a combo box which is used to find a record on the form. I have set LimitToList = Yes and put in code for the event NotInList.

My problem is that my code is working fine allowing me to produce my own message, but then the standard message appears as well saying "The text you entered is not an item in the list"

Has anyone any ideas please?

View Replies


ADVERTISEMENT

Modules & VBA :: Form Which Has Button To Email Data Out In Standard Email Message

Jan 15, 2014

I have a form which has a button to email the data out in a standard email message.

Private Sub Command60_Click()
Dim MyDb As dao.Database
Dim rsEmail As dao.Recordset
Dim sToName As String
Dim sSubject As String
Dim sMessageBody As String

[code]...

This works well enough, however, FIELDS 11 through to 16 contain the venue address. This is all we ll and good if every field of the venue address is populated. here are times when not all of the fields are populated, for instance, the address might only be 5 lines.I know I can do this using IIf statements on a report, but how can i achieve the same thing for the email.

View 6 Replies View Related

Searched Still Need Help :( Standard Dev

Aug 8, 2007

In one record (or row?) there I have 10 fields (columns), how can i find the standard deviation of those 10 numbers. Seems to only want to be able to do standard deviation if all data is in one field or column. I tried doing a query but same thing, if all the fields are across, it doesatn find the standard deviation of them. Please help this worthless access user. Thank you, I look foward to all the help I can get. As you can see, I still am struggling with even terminology. Excel is easy to me, access is a challenge to say the least.

View 3 Replies View Related

How To Set Standard Value To Yes For Yes / No Datatype

May 7, 2015

the standard value for the yes/no datatype = no..I try to set the standard value to yes but I can not be allowed for yes ? how do I set it to yes ? I have open the table, then I could not change to yes.

View 2 Replies View Related

NotInList DAO Or ADO?

May 18, 2005

I added the notinlist event to an unbound combo (I use access 2003) and used the ADO code but no matter what I try I can't get it working. Out of desperation I substituted the DAO code and "bingo" I have a working combo which adds any data I type in etc, no errors no problems. My question now is; Do I now stick with the old rule "if it ain't broke don't fix it" and continue using the DAO code or do I continue to pull my hair out (not much left now) trying to get the ADO code working?

View 2 Replies View Related

NotInList X 2

Nov 21, 2005

This is the NotInList I have been using for some time (below). it works well but only updates one field. I need to update two fields now, City and ZipCode. Can I add data to two fields each time the notinlist is envoked?


On Error GoTo Err_ErrorHandler
Const Message1 = " Is Not In The Database."
Const Message2 = "Would you like to add it?"
Const Title = "Unknown entry..."
Const NL = vbCrLf & vbCrLf
Dim db As DAO.Database
Dim rs As DAO.Recordset
If MsgBox(NewData & Message1 & NL & Message2, vbQuestion + vbYesNo, Title) = vbYes Then
Set db = CurrentDb
Set rs = db.OpenRecordset("MyTbl or Qry")
With rs
.AddNew
.Fields("MyField") = NewData
.Update
.Close
End With
Response = acDataErrAdded
Else
Me.MyField.Undo
Response = acDataErrContinue
End If
Exit_ErrorHandler:
Set rs = Nothing
Set db = Nothing
Exit Sub
Err_ErrorHandler:
MsgBox Err.Description, vbExclamation, "Error #" & Err.Number
Resume Exit_ErrorHandler

View 3 Replies View Related

Standard Navigation Buttons?

Apr 12, 2006

Does anybody know if it is possible to set extra code to any of the standard navigation buttons?

In other words, is there is Sub that corresponds to each navigation button that can be modified?

For example, for "Next>", is there a
Private Sub cmdNext_Click()
...
End Sub
???

View 1 Replies View Related

Form With Standard Text...how??

May 18, 2005

:rolleyes: I have a note field in a table for short description of a building parts. Is it posseble to make some standard text in a form with a "values" between the text to choose from?
Like:
This building is from "text field for input"
The roof is made of "a combobox with 4-5 items to choose from".

The standard text with the choosen values should then be sent to a note field at submit.

Like: This building is from 1945
The roof is made of tegl

Greeting

Alrun

View 1 Replies View Related

Editing Of Standard Paragraphs

Jan 17, 2005

From a form build a report using standard paragraphs using a combo or list box . Paragraphs may vary in length but must format correctly on the report. NO SPACES MUST BE LEFT BETWEEN PARAGRAPHS. Also the form must allow editing of the standard paragraph. ie where there is perhaps a change of name etc: ALSO is it possible to exceed the 255 characters in a text box ?

View 3 Replies View Related

NotInList Error

Mar 9, 2006

hey
Well I'm haveing some problems here.
When I type something in my combobox that aint in the list it doesnt go to the precedure NotInList.

I need this for both of these comboboxes and I tried an altarnative way with rowsource but that aint working aswell
so here is the code

Private Sub cboReeks_AfterUpdate()
If cboReeks.Text <> cboReeks.RowSource Then
Call Foutmelding("U hebt een foutieve waarde ingevoerd")
cboReeks.Value = ""
End If
End Sub

Private Sub cboRonde_NotInList(NewData As String, Response As Integer)
Response = 0
Call Foutmelding("U hebt een foutieve waarde ingevoerd")
cboRonde.Value = ""
End Sub

Thanks Cobra

View 5 Replies View Related

NotInList Code

Dec 19, 2006

Hi all. This is the code that I have used in my NotInList event

Private Sub Suppliers_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_Suppliers_NotInList

'-- We may need to add another Product
Response = MsgBox("[" & NewData & "] is not yet a valid Supplier..." & vbCr & vbCr & _
"Would you like to add this Supplier to your DataBase?", vbYesNo)

If Response = vbYes Then
'-- Create a new Product record
Dim db As DAO.Database
Dim MySQL As String
Set db = CurrentDb()
MySQL = "Insert Into TableSupplier (Suppliers) " & _
"Values(""" & NewData & """)"
db.Execute MySQL, dbFailOnError
Set db = Nothing
Response = acDataErrAdded '-- will requery!!
Else
Response = acDataErrContinue
End If

Exit_Suppliers_NotInList:
On Error Resume Next
Set db = Nothing
Exit Sub

Err_Suppliers_NotInList:
MsgBox "Error No: " & Err.Number & vbCr & _
"Description: " & Err.Description
Resume Exit_Suppliers_NotInList
End Sub

The problem i'm having is that the code is not working. However, I have used the same code but modified to suit on another field elsewhere in the form which works fine. Any ideas????

View 4 Replies View Related

Can't Get The Access Standard Menu To Show Up

Feb 2, 2007

the computer next to me doesn't have the standard menu showing,
and I can't figure out why, because the settings are the same as mine.

WITHOUT File, Tools, etc, its hard to teach a new person how to use
it. . .

where do i look, how do i get the menu bar back. . .

thanks

sportsguy

View 1 Replies View Related

How Can I Modify The Standard Access Form?

Sep 18, 2005

Hi
I am getting fed up of repeatedly modifying the basic new form in Access 2003 since I hate Tahoma and I never want dividing lines and I always want the VBA to be Option Explicit and I have my own ideas on colour schemes etc. etc.
Every new form I enter I have to make all the changes manually and simply wondered if I am being an ass. I can modify templates in Word and Excel so if I could do the same thing in Access I could save myself cumulative hours of work.
I cannot seem to find anything so does everyone else bow to what Microsoft think a form should look like or do you all do what I do and endlessly recreate the same starting point for each form???
Any pointers would be 110% wonderful!!
Best wishes

View 3 Replies View Related

Modules & VBA :: Standard Way Of Declaring Constants?

Mar 11, 2014

I know that a public constant is available to all subs and modules. I also know that you can only declare these in a module, you can't for example declare these in the form.

So how what is the best way of declaring them?

At the moment I just have a module that has nothing else except for the 3-4 constants that I use throughout all my forms. Is that ok?

View 5 Replies View Related

ComboBox Notinlist 2 Fields

Apr 11, 2006

OKay so i have a combobox with 2 fields, City and CityCode. (i.e. Albany, ALBA) I want to be able to type in a new citycode or city so that when it's not in the list the user can add it to the list along with the field that they're not entering which would be city or citycode. Please help! thanks

View 1 Replies View Related

Help On NotInList SQL Syntax Error Please..

May 13, 2007

Hi All, I'am using the following code to update a table (tbl_CDT) on a NotInList event of a cboBox (CDT) I keep getting a SQL syntax error message, can anyone help resolve the code please

Private Sub CDT_NotInList(NewData As String, Response As Integer)

On Error GoTo CDT_NotInList_Err
Dim intAnswer As Integer
Dim strSQL As String
intAnswer = MsgBox("The CDT " & Chr(34) & NewData & _
Chr(34) & " is not currently listed." & vbCrLf & _
"Would you like to add to the list now?" _
, vbQuestion + vbYesNo, "DentureBase")
If intAnswer = vbYes Then
strSQL = "INSERT INTO tbl_CDT's([CDT_Name]) " & _
"VALUES ('" & NewData & "');"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
MsgBox "The new CDT has been added to the list." _
, vbInformation, "DentureBase"
Response = acDataErrAdded
Else
MsgBox "Please choose a CDT from the list." _
, vbInformation, "DentureBase"
Response = acDataErrContinue
End If
CDT_NotInList_Exit:
Exit Sub
CDT_NotInList_Err:
MsgBox Err.Description, vbCritical, "Error"
Resume CDT_NotInList_Exit


End Sub
Thanks very much

View 9 Replies View Related

Supressing NotInList Response...

Jun 29, 2005

Looking for a way to supress this message box...
The text you entered isn't an item in the list.

Select an item from the list or enter text that matches one of the listed items.
... when the NotInList event fires.

Trying to just open an unbound modal form, pass a couple values to it, and set focus on a particular combobox for additional information to be added to my lookup table:

Private Sub cboPostalCode_NotInList(NewData As String, Response As Integer)

On Error GoTo Err_ErrorHandler

Const Message1 = "The postal code you have entered is not currently on record."
Const Message2 = "Would you like to add it?"
Const Title = "Unknown Postal Code"
Const NL = vbCrLf & vbCrLf

If MsgBox(Message1 & NL & Message2, vbQuestion + vbYesNo, Title) = vbYes Then
DoCmd.OpenForm "frmPostalCode"
Forms!frmPostalCode!cboCountryID = Me.cboCountryID
Forms!frmPostalCode!txtPostalCode = NewData
Forms!frmPostalCode.SetFocus
Forms!frmPostalCode!txtCity.SetFocus
Else
Me.cboPostalCode.Undo
End If

Exit_ErrorHandler:
Exit Sub

Err_ErrorHandler:
MsgBox Err.Description, vbExclamation, "Error #" & Err.Number
Resume Exit_ErrorHandler

End Sub

Any thoughts?

Regards,
~Chad

View 1 Replies View Related

Cascading Combo & NotInList

Oct 3, 2006

I have 2 Cascading Combo boxes setup and working correctly.cbo1 lists all agents and cbo2 lists the branches that relate to each agent.tbl_agents and tbl_branches are setup with a 1 to many relationship.I have used the code (explained here (http://www.fontstuff.com/access/acctut20.htm)) that allows the user to add a new agent if they are not in the list. This works correctly. Now I want to let the user add a new branch for the agent they have just added. The code appears to work correctly from the front end, but when you check tbl_branch, there is a new entry but it is missing the appropriate agentID foreign key (ie, it's not related to the new agent).Is there something that I'm missing? I assume this is possible, but I must be doing something wrong.Maybe I need to create a little pop-up form for data entry?any help appreciated.

View 7 Replies View Related

Tables :: Standard Length On Random Autonumber

May 30, 2014

I need to restrict the random autonumber feature to 10 digits and a positive number for a primary key. I work in the medical field, and HIPAA privacy regulations require the use of random ID numbers to identify records. Also, I need the numbers to be positive numbers because we will be using barcode scanning equipment and the possibility of truncating the negative identifier creates the possibility (admittedly remote) of having a duplicate PK barcodes. I understand that we cannot change the Access feature, but any VBA code to generate a truly random 10 digit positive number I can use as a PK?

View 4 Replies View Related

General :: Filtering Results Outside Of Standard Deviation

Oct 16, 2014

I am trying to create a query that filters results only outside of 1 standard deviation of the mean. Is there an option for this in the criteria spot? I'm fairly new to Access and I'm not sure if I can reference a particular cell in the criteria.

View 1 Replies View Related

Tables :: Use Of Standard Access IDs As Primary Keys

Feb 12, 2014

I've built a system with around 20 tables in it. All of these use the standard ID field offered by default by Access as the primary key. A friend with a background in database design and development for large corporates using Oracle has reviewed the database (he is going to do some VBA programming for me) and suggested that we use more appropriate primary keys based on data attributes.

He has read "somewhere" that there are problems with the standard ID fields and that occasionally the fields are renumbered/reindexed and that this can cause problems. There are a fair number of queries and some complex forms which will need to be updated for these changes but it would be a shame to go through all this work if it isn't really.

Should we use the standard Access IDs and is it worth a chunk of effort to change from where we are now?

View 6 Replies View Related

Data Misnatch In NotInLIst Event

Jul 28, 2005

OK here is what I have:

Table Name: Student
Fields: Auto (Primary Key)
MOI (number)
Name (Text)

I have 2 forms:
1) Student ,which contains student info I have created a combo box in this form for MOI, so whenever I type an MOI ID that have been previously entered I get the student Name, if it's not previously entered I used the NotInList Event, that asks the user if he wants to add the new value in the list if Yes, it will forward him to the second form

2) student_info, which is an entry form the user enters the name of the student and go back to the student form.

The following is the NotInList event code:

Private Sub Combo10_NotInList(NewData As String, Response As Integer)
Dim Result
Dim Msg As String
Dim CR As String

CR = Chr$(13)

' Exit this subroutine if the combo box was cleared.
If NewData = "" Then Exit Sub

' Ask the user if he or she wishes to add the new student.
Msg = "'" & NewData & "' is not in the list." & CR & CR
Msg = Msg & "Do you want to add it?"
If MsgBox(Msg, vbQuestion + vbYesNo) = vbYes Then

' If the user chose Yes, start the student_info form in data entry
' mode as a dialog form, passing the new MOI in
' NewData to the OpenForm method's OpenArgs argument. The
' OpenArgs argument is used in student_info form's Form_Load event
' procedure.
DoCmd.OpenForm "student_info", , , , acAdd, acDialog, NewData
End If

' Look for the student the user created in the student_info form.
Result = DLookup("[MOI]", "student", _
"[MOI]='" & NewData & "'")
If IsNull(Result) Then

' If the student was not created, set the Response argument
' to suppress an error message and undo changes.
Response = acDataErrContinue

' Display a customized message.
MsgBox "Please try again!"
Else

' If the customer was created, set the Response argument to
' indicate that new data is being added.
Response = acDataErrAdded
End If


End Sub


The code is working perfectly except for one problem:

When I'm in student_info form to enter the name of new student and I want to go back to the Student Form I have this error message:

data type mismatch in criteria expression


I figured maybe because I'm passing a number field and in the DLookup criteria it assigns the MOI (which is number) to NewData which is String as follow:

DLookup("[MOI]", "student", _
"[MOI]='" & NewData & "'")

Attach it the database for better understanding of my prolem.
Any help will be very much appreicated!

Thanks,
CS.

View 14 Replies View Related

Modules & VBA :: NotInList For Multiple Records?

Aug 1, 2013

I have two tables: Products and Invoice. Product table is for creating product list which will have additional information about products for calculations latter. Invoice is table which contains information about invoices and bought products. Invoice table column Product is combo box which I created that user wouldn't type same product in 100 variations (list is from table product column product description).

One invoice can contain more than one product which is not in product. NotinList add notinlist products to list but only one product at time (at least I know only this way).

Is it possible to add multiple records with notinlist? what i would like to to is:

1. user adds new invoice and access doesn't bothers with error messages about item not in list
2. after invoice have been added, access checks if all product is in list and offers to add those ones which is not in list to add to list.

View 6 Replies View Related

Forms :: Combobox NotInList But Not Null Either

May 31, 2013

User pick a record from a list and are able to doubleclick that record which will open another form with that record's ID. If the field is Null, then another form opens allowing the user to create a new record. The part that doesn't work, is if that record that was in the combo, gets deleted from somewhere else. Then the ID is still being shown in the combo (that's OK but it's no longer null), so double clicking the field does not bring up the correct Create New record form.

What I would like to have is something similar to the NotInList message that states something like, "That record has been deleted". This is what I have so far,If not in list

Code:

Private Sub APID_NotInList(NewData As String, Response As Integer)
MsgBox "Please select an ... or double-click this field to add a new entry to the list."
Response = acDataErrContinue
APID = Null
End Sub

On double clicking the combo

Code:
Private Sub APID_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String

[code]....

View 5 Replies View Related

Standard Form Used To Display User-custom Query

Nov 15, 2006

Hi,

I have generated a standard form for displaying/editing of data and I have also created a form for generating Sql query statements (The form builds a string but does not execute the query). Can I execute a query and use it with that form.

So when I generate the the SQL statement and execute the query it loads the form (With Data) instead of a query datasheet. Thank you.

View 1 Replies View Related

Using The NotInList Event And Updating Two Fields The Table

Nov 26, 2005

I have a data entry form where country(ies) (there can be more than one for
each project) is/are entered in a sub-form on a tab control. Countries not
listed are entered by the following:

Private Sub CountryName_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
Dim strMsg As String
Dim ctl As Control
Set ctl = Screen.ActiveControl

strMsg = "Country " & NewData & " Is not listed!" & vbCrLf & "Do you want to
add it?"
If MsgBox(strMsg, vbYesNo, "Not listed") = vbYes Then
strSQL = "INSERT INTO tblCOUNTRY (CountryName) "
strSQL = strSQL & "VALUES('" & NewData & "');"
CurrentDb.Execute strSQL
Response = acDataErrAdded
Else
ctl.Undo
Response = acDataErrContinue
End If
End Sub

This works fine. However, if I restrict the country names by a region
selection on the main form (for example if region Africa is selected on the
the African countries are preselected) the NotIn List does not work. Any way to work around this?

Another question, I want the user to select a region (a combo box ) on the
main form and when a new country (using the NotInList event) is entered in the subform both values go into
the same record in tblCountry (which has two fields CountryName and Region).
For example, I enter AFRICA for region on the main form and on the sub-form I enter Malawi which is not listed. I have tried the following:

Private Sub CountryName_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
Dim strMsg As String
Dim ctl As Control
Set ctl = Screen.ActiveControl

strMsg = "Country " & NewData & " Is not listed!" & vbCrLf & "Do you want to
add it?"
If MsgBox(strMsg, vbYesNo, "Not listed") = vbYes Then
strSQL = "INSERT INTO tblCOUNTRY (CountryName, Region) "
strSQL = strSQL & "VALUES('" & NewData & "', FORMS!frmAddPro!Region);"
CurrentDb.Execute strSQL
Response = acDataErrAdded
Else
ctl.Undo
Response = acDataErrContinue
End If
End Sub

But it does not work (Region is the control on the main form named frmAddPro).
Any suggestions would be welcome. Thanks.
Niels

View 4 Replies View Related







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