Listbox Only Makes Exclamation Sound
Nov 30, 2006
Hi All,
I have been trying to improve a form used to add/edit names in a mailing list. What I want to do is check the database for possible duplicate names and alert the user to the fact that their new person may already be in the db.
I used the following VBA code in the After Update event as follows:
Private Sub txtLastName_AfterUpdate()
On Error Resume Next
Dim strLastName As String
Dim NbrNames As Variant
Dim strNameSQL As String
txtLastName = Trim(txtLastName)
If Not Mid(txtLastName, 1, 1) = "=" Then
txtLastName = StrConv(txtLastName, vbProperCase)
Else
txtLastName = Mid(txtLastName, 2, 999)
End If
' Test for duplicate last name in data base
NbrNames = DCount("[tblMemberListings].[mlLastName]", "tblMemberListings", "[tblMemberListings].[mlLastName]= '" & txtLastName & " '")
If NbrNames > 0 Then
strNameSQL = "SELECT ALL tblMemberListings.mlID, tblMemberListings.mlLastName, tblMemberListings.mlFirstName, tblMemberListings.mlSpouseSO, tblMemberListings.mlAddress " & _
"FROM tblMemberListings " & _
"WHERE ((tblMemberListings.mlLastName) LIKE '" & txtLastName & "*') " & _
"ORDER BY tblMemberListings.mlLastName, tblMemberListings.mlFirstName, tblMemberListings.mlSpouseSO;"
lstDuplicateNames.RowSource = strNameSQL
Beep
lstDuplicateNames.Visible = True
End If
End Sub
This generates a useful list of potential persons already in the db. The user then has the choice of continuing to add the new name and address or they should be able to select one of the names in the listbox and refresh the form with that person's data for possible modification.
I currently have these two Event Procedures in place:
Private Sub lstDuplicateNames_AfterUpdate()
On Error Resume Next
'MsgBox "Sub lstDuplicateNames_Click value = " & lstDuplicateNames.Column(0)
If Not IsNull(lstDuplicateNames.Column(0)) Then
' User chooses and existing record
Me.RecordsetClone.FindFirst "[mlID] = " & lstDuplicateNames.Column(0)
If Not Me.RecordsetClone.NoMatch Then
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
Me.lstDuplicateNames.Visible = False
Me.Refresh
End If
End Sub
and
Private Sub lstDuplicateNames_Click()
Me.txtHidden.SetFocus
Me.lstDuplicateNames.Visible = False
End Sub
The problem is that when one clicks on one of the listed names just two things happen:
1 - a fine dotted box outline appears around the *first* record in the listbox
2 - the MS Exclamation wav sound is generated each time the mouse button is clicked. :confused:
Short of enrolling in a local junior college that offers Access 101 what can I do to get this addition working? I'm also not sure that my code to refresh the form is going to work, but right now I don't ever get there. ;)
Oh, this problem is occurring in MS Access 2000.
Any help would be greatly appreciated by this NOOB.
Divit11
View Replies
ADVERTISEMENT
Nov 5, 2014
Is it possible to format a textbox such that a negative value doesn't show numerically but in some other form (like a cross or exclamation mark from the Wingdings font, for example?)
I have a couple of textboxes which take their values from a function. The function is designed to return a long integer value which should always be greater than or equal to zero (the function counts the number of outstanding e-mails in a given Outlook folder, hence it should always be zero or higher)
However, as part of my error handling, if the function can't connect to the Outlook folder for whatever reason (for example, if the user does not have the appropriate permissions, or they do not have it mapped etc.), then it returns -1 (so I have some sort of value to identify a fail)
So currently, if such an error occurs, my textbox(es) will show -1 (and I can use conditional formatting to highlight this)
But it would be nice if it showed an "X" or "!" instead, and only showed the numerical value for 0 or positive. Is this possible?
View 14 Replies
View Related
Jun 11, 2015
I've created a report which i'm exporting to PDF,but when I open the PDF I can see that some characters are replaced by a question-mark in a box.
for example : RMA Number: 5002408...here the empty characters after number and the : are replaced by a questionmark in a box...if I export to other programs i don't have this problem..
View 2 Replies
View Related
Mar 4, 2014
I have a training database that I have set up and utilize to track attendee data and who is registered to which course.I have a course registration table that has a course title field which is a drop down list populated by course titles from the courses table, and a trainee id field.
For whatever reason, when I view reports or queries that draw from this table, access will make changes to the first record in the course registration table course title field i.e. it will take whoever is in the first record, and change the course they were registered to.
View 10 Replies
View Related
May 7, 2014
I want to track how many orders a user makes. So every time they place an order it increments 1 after each order.
I currently have the following tables,
Order
OrderDetail
User
Should i create an UserOrderHistory table?
Eventually i want this information to form part of an order number. eg
196(order primary key) AR (UsersInitials) /23 (number of orders User has placed)
View 5 Replies
View Related
Aug 11, 2015
I use Access 2013. Is there an easy way to do the following: I have a contract that starts on eg 01/07/2015. Tenant has to pay 100 each month. Is there a way to create a query/table/... where access automatically makes a due date? EG: Joe needs to pay me 100 each month, starting 01/01/2015 until 31/12/2018.
This means:
01/01/2015 - due 100 from Joe
01/02/2015 - due 100 from Joe
...
01/12/2018 - due 100 from Joe
View 1 Replies
View Related
Sep 26, 2005
Im sorry that i am a noob.
I want to ask how do i add a sound after I have timer to display countdown time. When the timer reaches 00.00, the sound will appear. How do i do that?
View 1 Replies
View Related
May 22, 2006
Is there a way to attach a wav file or mp3 file to a command button?
View 2 Replies
View Related
Jan 7, 2006
Ladies and Gents
I am wondering if when i run my report is there anyway that the detail of the report can become objects that say i could drag and drop into a Word Doc for example. I am trying to create a tool that will allow me to see all jobs from our maintenance mangement system at work, i have managed to achieve this but i was wanting to be able to view the jobs on a report and then basically just drag them into something else and wahey i have built my plan for the week.
Maybe i am hoping for to much but i though i would ask anyway.
paul
View 1 Replies
View Related
Aug 7, 2006
i probably want to create a upddate querry or maybe some code but...
i have a light bulb and i keep 300 on hand i just ordered 300 more when i check the box that the order is complete i need the "bulb on hand" feild to update to 600....please help
View 1 Replies
View Related
Mar 27, 2007
Hello,
I'm working on a splash screen to spruce up the opening of one of several databases I've created. I hate for them to appear boring so I like to add a bit of color at the beginning, a la Northwind's.
I haven't found anthing on this yet so I thougt I'd ask...
How can I have a sound I've downloaded from clipart or somewhere, PLAY when the form opens or loads or whatever...
Thanks in advance!
Goh
View 1 Replies
View Related
May 11, 2005
Is it possible to have a set sound play when a form is opened? And if so does anyone no how it is done?
Thanks in advance for any help
View 3 Replies
View Related
Jun 22, 2005
how can i automatically play sound files in forms i still use access 2.0
View 1 Replies
View Related
Nov 16, 2014
I want to add a sound (not beep but a small wav) to an event in a form.
View 2 Replies
View Related
Sep 15, 2013
I have to tables:
Table 1 contains "cases picked"
Table 2 contains "cases required"
i have a query with info populated from those 2 tables:field "results" shows the results of this calculation: "cases required"-"cases picked"="results".In this query I have a conditional format stating: If true, displays text "ok" and the field will be green, if false, displays text "alert" and the field will be red.
Then I have this query in a subform (a form within another form),I would like to have a code or a formula for this query, where it would play a sound if (and only in this case) the value of "cases picked" is bigger than the value in "cases required"
This is how it works, you open the main form, start using a barcode scanner to scan cases, everytime you scan each case, the subform is refreshed and adds cases, and shows results, and shows how many cases you are missing or how many cases you are over, but this is only in the screen, i would like to have a sound in this subform, so in case you pick more cases than required, a loud sound is played as an alert, i still can't figure out where to put the solution, if as a formula in the query, or a code in the subform.
View 2 Replies
View Related
May 19, 2014
I'd like to make noise to another computer, or start same sound file or simply to call another computer on lan or through vpn connected computer using vba...
That will be nice if I can press button on access form and user on another computer hear some noise or to loo like it is call
View 1 Replies
View Related
Jun 3, 2013
Is it possible to play any kind of sound file from Access?
View 1 Replies
View Related
Jun 7, 2015
How can I play a sound with event On Open Form.
View 13 Replies
View Related
Nov 16, 2014
I do not understand what is happening here. I have foll0wing line in a calculated query field:
m: Switch([EmpID]<5,1) ' run Query 18 in attached example, A2007/2010
this produces 1 for all EmpID<5 and Null for all other EmpID's. All as expected.
But if I do this:
m: Switch([EmpID]<5,1,[EmpID]>=5,Null) ' run Query 19 in attached example
then the entire column is set to Null
View 2 Replies
View Related
Jan 31, 2015
Nothing else to explain really. How can I get my database to make a beep sound when something is trying to be typed into a locked textbox control?
This is so that my users can know that it's locked (much like when the delete button is pressed on a new record).
View 6 Replies
View Related
Apr 21, 2006
Hi, I'm new here, so I hope I'm posting this in the correct place. I've searched the forum to see if there are any existing threads that might help me, but I've not found anything that does...
(I think this thread ( http://www.access-programmers.co.uk/forums/showthread.php?t=93444&highlight=Copying+data )may be trying to achieve something similar to me, but I'm a beginner and don't really understand it)
I shall stop waffling! I'm not entirely sure that what I'm trying to achieve is possible, I expect it probably is!
Right, I have a form (frmGroupRegister, which contains exactly the same fields as the table it comes from, tblGroupRegister), which consists of three things:
-GroupDate - The date a group took place on. It is my primary key, as no more than one group occurs on a specific date.
-ParentList (A listbox which contains a query showing the ID number, forename and surname of everyone in a table, tblParentDetails)
-ParentsAttending (A blank listbox)
I would like to place buttons in between the ParentList and ParentsAttending, which would allow users to conduct a 'register' of attendance by copying individual/multiple details from ParentList into ParentsAttending (much like you get when choosing which fields to include in a form when using a wizard for example). I would also like them to be able to remove people from ParentsAttending by using a button in case of accidentally adding the wrong person into the ParentsAttending box.
I'm aware that another, probably simpler way of achieving this would be to use a tick-box system, but I feel that visually, the first method would both look better and demonstrate who is present more clearly.
Any help would be much appreciated, but my Access skills are quite basic and things will probably need to be spelled out for me.
I'm using Access 2000 and Windows XP.
Thanks for your help,
Alice :)
View 1 Replies
View Related
Jun 10, 2015
I am using the selections made of the form to generate a query for the user.
I have a CITIES listbox that is populated with values from a stored query.
I would like to make it multi-select and populate a LOCATIONS list box and a NAMES list box based upon the CITIES that are selected.
I have the locations currently populated from a stored query that reads the City selection from the Form. It looks like this
Code:
SELECT DISTINCT (t_location.LOCATION) AS Expr1
FROM t_location INNER JOIN t_asset_master ON t_location.LOCATION_PHY_ID = t_asset_master.LOCATION
WHERE (((t_location.CITY)=[Forms]![MasterQueryGenerator]![CityList]));
I also want multi-select so that is you can un-select all and get the results for all cities.
Here is my half thought approach.
Code:
Private Sub CityList_AfterUpdate()
'Dim LocQryStr As String
'Dim r As Integer
'Dim ctl9 As Control
'LocQryStr = "SELECT DISTINCT (t_location.LOCATION) " & _
[Code] ...
I intended to have the variable LocQryStr as the row source but I abandoned the idea of having multi-select when I saw that .Selected(I) never returned true. Its like the values aren't read in this subroutine.
View 5 Replies
View Related
Sep 9, 2013
I have a list box called "product list box" based on a query called "searchqry", i also have another listbox called "type list box" , how do i get the type list box to only show "types" based on the section in products list box?
View 1 Replies
View Related
Dec 14, 2014
Using a popup form
1. On my main form, I have a listbox, I would like to edit the values of the listbox.
To do this, I have a popup form with 2 listboxes, one to have the values of the listbox on the main form, and the other listbox with option values for the 1st
1) how to i pass the rowsource sql of the listbox on the main form to the listbox on the popup form
2) how on closing the popup form, do i update the rowsource sql listbox on the main form from the changed value of the popup form listbox rowsource sql
View 3 Replies
View Related
Oct 23, 2013
Okay then, after much trouble and confusion, I finally realized I need to use an Extended listbox in order to allow for multiple items to be selected from a list on my form (rather than the evil multiple selection combobox!).
However, now I am trying to figure out how to make one listbox (IndustryClassification) only be visible if the item "Industry" is selected in another listbox (TypeOfBusiness). Coding I can use for this in the AfterUpdate event of the listbox?
View 7 Replies
View Related
Jun 17, 2005
Hello,
I've got this multiple select listbox which writes data into a textbox:
Private Sub List2_AfterUpdate()
Dim Cursisten As String
Dim ctl As Control
Dim Itm As Variant
Set ctl = Me.List2
For Each Itm In ctl.ItemsSelected
If Len(Cursisten) = 0 Then
Cursisten = ctl.ItemData(Itm)
Else
Cursisten = Cursisten & "," & ctl.ItemData(Itm)
End If
Next Itm
Me.txtCursisten = Cursisten
End Sub
And I've got a SELECT ALL button to select all records in the listbox:
Private Sub cmdSelectAll_Click()
On Error GoTo Err_cmdSelectAll_Click
Dim i As Integer
If cmdSelectAll.Caption = "Alles Selecteren" Then
For i = 0 To Me.List2.ListCount
Me.List2.Selected(i) = True
Next i
cmdSelectAll.Caption = "Alles De-Selecteren"
Else
For i = 0 To Me.List2.ListCount
Me.List2.Selected(i) = False
Next i
cmdSelectAll.Caption = "Alles Selecteren"
End If
Exit_cmdSelectAll_Click:
Exit Sub
Err_cmdSelectAll_Click:
MsgBox Err.Description
Resume Exit_cmdSelectAll_Click
End Sub
The only thing is that when I use the SELECT ALL button, the function List2_Afterupdate doesn't work anymore. There must be a simple solution but I just can't figure it out. Can anyone please help me?
Tnx a lot!
View 13 Replies
View Related