i have a form which contains three subforms. the subforms are based on queries which get their parameter value from an option group. all this was working fine until i had the bright idea of displaying a msgbox when no records are found in the subforms.
i had entered the following code that i had found on one of the posts in this forum:
Private Sub Form_Open(Cancel As Integer)
If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "There are zero records in the data source!", vbInformation, "No Records Found"
DoCmd.Close acForm, Me.name
End If
End Sub
the trouble is that if the user makes a selection in the option group whereby there are no records in two or more subforms, it throws up two different msgboxes stating the same.
I want the form to be such that everytime the subforms are requeried, there shud be only one msgbox stating tht no records were found for the relevant subforms. (this msgbox doesnt appear when there are records). for eg the msgbox shud say that "no records found for subfrm1 and sbfrm2 etc". if subfrm 1 and two don't have records but subfrm3 does.
The record source of a form that I have is based on a user selection in a combo box in the header of the form. When the form opens there may or may not be any records to display. Currently I put up a message box when there are no records displayed but this only happens when the form is newly opened.
I was wondering if it is possible to have a label displayed in the detail section instead whenever there are no records to display, such as something along the lines of "There are no records to display with the selected option, please choose an alternative.".
I realise that I may be asking the impossible but I'm a member of the "If you don't ask you'll never know" club.
I have a form designed to execute a query with a prompt for a particular record. When the record being searched for is not there the form become blank with nothing on it. I would like to return a message that indicates that the record was not found and give he user an option of reexecuting the query of exiting the form.
I am using a query to search for records and I'd like there to be a message box that pops up on the search page if there are no records found (so the query is empty). I'm guessing there is a simple solution since I think I just need an "If" statement checking to see if a field in the query is null or not. However, I'm not familiar with Access code and what I've tried so far does not work. Any help is greatly appreciated! p.s. I am using Microsoft Access 1997...old school...
I have a table that is a list of available UPC codes that through forms are being assigned to several different tables (types of items). When the UPC code is assigned, there is a yes/no box which is checked. I need to have a message box appear when the last of these UPC codes has been used (or better yet perhaps when there are a specific number left - such as 10 - so the user isn't all of a sudden locked out of any more work).
It could even be triggered when a specific UPC code is reached - they will be in numerical order (ignoring the check digit). Is there anyway to do this globally or would the check need to be on each form as the UPC is assigned?
Hey. Basically I have several tables. One table (vistiors) has a combo box in one field called Hostee. Each hostee is listed in another table with all their information. When a hostee is selected in the hostee field of the visitors table I simply need it to count how many people including the currently selected person are being hosted by the person and check if it is greater or less than the amount of people set in the host table which has a field called Limit that has a number which is the maximum amount of people one person is willing to host.
If its greater than the amount in the host table a warning message should come up informing the person (but still allow the assignment to occur.)
As a note I have the combo box set to show the first name of the individual but select both the first name and ID
the code is below for the row source:
SELECT [Hosts].[First Name], [Hosts].[id] FROM Hosts;
If someone could tell me how I could get it to show multiple things within the combo box that'd be great.
IE Right now it shows just a first name liek Alex, Rachel, Bill. I'd like it to show the first name as well as the last name and a third additional field. IE Alex Lastname T1 or Rachel Lastname F4 etc.
Can anyone show me the general code to do this? I do know some VB but I'm used to using SQL with PHP primarily. I am new to access and only know it vaguely. Thanks in advance!
I have a field in a table called surname. This is not the primary key and I don't want to set it as a unique field however I want there to be a message box that comes up saying "There is already another person of this surname (or something like that" if the surname entered already exists in the database.
I have two tables, categories and items. I have a form that is linked to the categories table and a subform that is linked to the items table. The user selects a category on the main form then an item to add to the category on the subform. (all of this is functioning correctly - but you need to understand for my question.)
Both the form and the subform have a text box that displays a record from their respective table, for the example we will call this color.
What I need to do is create code that checks the color text box from the category (main form) against the text box for the item (subform) and if they are not a match I need to display a message box - from where I can then add the necessary actions.
EDIT: note this is not a query on an entire table or 2 it is just comparing the two text boxes on the form and subform
I have a button that duplicates records 'X' amount of times based on a value in a text box.
I need a message box to advise the user that they have created record number from - to
Eg
User creates 5 records - first record created has a auto number of 3200
I need the message box to say 'you have just created records 3200 - 3204
Is this possible?
Here is the current code on the duplicate button courtesy of Uncle Gizmo
Private Sub AddRecord_Click() On Error GoTo AddRecord_Click_Err Dim x As Integer For x = 1 To (Me.txtAmount.Value - 1) DoCmd.RunCommand acCmdSelectRecord DoCmd.RunCommand acCmdCopy
I use the following code for an error message box to pop up. I need to know how bring up a custom form I have made instead of the standard message box but don't know how to code it into the function.
Function StartUp() On Error GoTo Err_ProcedureName
Set db = CurrentDb Set rs = db.OpenRecordset("tblEmployeeBenefits", dbOpenDynaset)
If rs.EOF = False Then rs.MoveLast If rs.Fields("FlagDate") = True Then MsgBox "You need Administrative access for this function to work.", vbOKOnly, "Serious Warning" DoCmd.Quit End If
Else
If rs.BOF = True Then y = 0
Do Until x = 1 x = rs.RecordCount
rs.AddNew rs.Fields("MeDate") = Date + y rs.Update y = y + 1 Loop End If End If UpdateTable
I'm creating a simplified timecard entry form, and everything works perfect except one thing. When I start a new record and go to the subform and choose the day (monday - friday) it says "This property is read-only and cannot be set" but then it goes ahead and accepts the entry.
A little background, I am making the times as simplified entry (100 for 1pm, 800 for 8am, 500 for 5pm) no colons will be entered. Our hours of operation are roughly 7am until 630pm, with the occassional clock in before 6am and clock out up until 8pm or so. I have this error checking in place, it works ok, I add 1200 to the time if it is pm. Now if they are making a straight time adjustment, they enter it in as well.... for instance 8 for 8hrs holiday pay or paid time off. All this stuff works, that's not the problem.
I am thinking, maybe it might have something to do with having 4 or 5 fields set as the combined primary key on the table that holds the time/adjustment data. The reason I did the combined primary key is so they could enter in the same name, the same start date, even the same day, but the adjustment/time value has to be unique when it is compared with the start date, name, day, adjustment/time value. This table is the subform.
The weird thing is, that after the error, it lets the value stand and does not show the error again, as long as you are on this recordset. If I go back into that record and start a new entry below the others, I get the error again. While the error has no detrimental effects on the db, it is annoying.... and it still shows if I run the form off a macro with setwarnings to false.
I am including the database for review for those of you brave enough to try to understand my logic I'm sure it's something simple. I don't see anything in the properties for the form to turn off error messages like you can in data access pages, or maybe I just overlooked it. I have left one recordset in to show the functionality, it all works according to plan. This is just a rudementary database, I will fine tune it after I get past this hurdle.
Edit: I have Calendar control 11.0 for the start date, but this isn't the problem as it still did it when I had the actual field showing. That, and if you see the disparity between hours and minutes and paid time, it's because if they worked so many hours, 1/2 hour is automatically subtracted. Which is why there is a lunch adjustment field.... if they didn't take a lunch or if they took too long of a lunch.
I tried to get help elsewhere with this but it didn't quite work out, so I thought I'd pick a few other brains. So here's the problem from the beginning.
I made a table with three fields:
Field Name----Data Type Category------Text Item----------Text Cost----------Number
I set up a form with two combo boxes and two text boxes. I want to pick an Item from the combo box, and have the Cost appear in the corresponding text box. I set up the combo box to show each field when I click on the arrow.
I was given the following code to put in the After Update section under the Event tab for the combo box:
Private Sub Combo8_AfterUpdate() Me.Text2 = Me.Combo8.Column(2) End Sub
That works. I pick an item from the combo box, and its value appears in the text box next to it. Ultimately, I want to edit the value in the text box and have it update the table. I was given the following code for the text box:
Private Sub MyTextbox_AfterUpdate() Dim strSQL As String strSQL = "UPDATE MyTable " & _ "SET Myfield = " & Me.MyTextbox & _ " WHERE Id = " & Me.MyCombo CurrentDb.Execute strSQL, dbFailOnError End Sub
So far, that hasn't worked. I believe I've made the correct substitutions:
Private Sub Text2_AfterUpdate() Dim strSQL As String strSQL = "UPDATE [Primary Table] " & _ "SET Cost = " & Me.Text2 & _ " WHERE Id = " & Me.Combo8 CurrentDb.Execute strSQL, dbFailOnError End Sub
When I type a different value into the text box and hit enter, I get the following error:
Run-time error '3061': Too few parameters. Expected 2.
I was given a different line of code in the event that I'm "trying to pass text":
" WHERE Id = '" & Me.Combo8 & "'"
When I use that, the error is the same except it says:
All i want to do is after executing the following code, close the form " EmployeeFind" on completion?
Private Sub Form_DblClick(Cancel As Integer) On Error GoTo Err_Form_DblClick Dim stDocName As String Dim Msg, Style, Title, Response Msg = "Employee allocated to Job" Style = vbOKCancel + vbInformation Title = "Employee moved" ' Define title. Response = MsgBox(Msg, Style, Title) If Response = vbOK Then
I have tried numerous things to try and create a pop up message or form to alert users of a timing conflict in a scheduling program. I am not real familiar with codes and am not sure how to handle this.
I used Jason Browne's web site to help me construct a query that will list a result of time conflicts (ie some project is scheduled to occur before another one is completed). What I need to have happen is the alert message or form opens when this conflict occurs but does nothing when the timing is ok.
I am not very familiar with code and am having a road block mentally. All help is appreciated!
I have designed a form to act as a menu to open other forms. I created the form and placed command button on the form. Using the Access Wizard, the following VBA was created by Access to open the next form:
Private Sub cmdCCDolClr_Click() On Error GoTo Err_cmdCCDolClr_Click
Dim stDocName As String Dim stLinkCriteria As String
I have done this several times in the past with success. However, this time, I get the following error message when I click on the command button to open the second form.
The expression On Click you entered as the event property setting produced the following error: A problem occured while GCM (name of dB) was communicating with the OLE server or Active X Control. *The expression may not result in the name of a macro, the name of a user-defined function, or [EVENT PROCEDURE]. *There may have been an error evaluating the function, event or macro.
I tested other forms that were designed to open secondary forms and they continue to act correctly. Is there an easy fix to this issue. There are 16 command buttons and all get this message. Do I have to delete the form and recreate it. A nusiance, but not difficult.
Looking forward to hearing from you experts out there. Thanks, Alan __________________ Alan Sidman
When you use a combobox to search values in the form - and someone searches for a value that isn't there - the form just defaults to the first entry. Is there a way of putting a message box that says "This is a new patient" (or something like that). The NotInList event doesn't work - any ideas??
when i want to open the database in an access database i have the following error. you have as the event property setting the expression entered when open.This expression has caused an error amppu (database name) can not find the form that is referred to
I have a DCount code that traps duplicate records in the database and gives a message box. (the dcount is based on 2 criteria that are a compound index) I would like to have the message box ask if the user wants to go to the duplicate record. How would I write the code that when the user clicks yes, the form requeries and opens to the record that matches the criteria? Is there a way to add criteria to a requery?
I'm creating a DB that includes a form that "Customers" will fill out. The form (CustomerForm) has text boxs that must be completed. I'm trying to figure out how to make sure all text boxes are filled out. I have already created a Input Mask and selected Required in the "Customer" Table. There is also a Username text box I would like to have validated that is is not already being used and two password text boxes I would like to have validate against one another to ensure it was created correctly. Once all text boxes are properly filled out I would like the Button to Save customer data, close CustomerForm and Open ShoppingCart. This is the code I have created:
Code: Option Compare Database Private Sub Log_In_Click() If IsNull(Me.CustomerFName) Then MsgBox "Please Enter First Name", vbInformation, "First Name Required" Me.CustomerLName.SetFocus
I do have a DB that takes some data from Stripes and imports them into access. Since this will be a multi user DB I want to make a warning form.
Basically a user will do the download, I want a form or a pop up message that will show to the next user that will open the DB while the download process is ongoing, to see that the download data process is still ongoing, That he needs to wait until the data download has finished.
I have 5 check boxes on a form and one of them must be checked in order to get the correct result. If the user does not check any of the the five checkboxes he gets a msgbox telling him that he must checks one of the checkboxes.
What i want to ask is if is possible to prevent the form from updating? Because the user gets the error message but after that the form is being updated even though he hasn't check any of the fields.
I have created a profiling form for my school. Each boy can access his form using his admission number ( Adno) which is the primary key. On the form are lots of sub forms - for things like favourite authors, clubs, teams played in etc - but these don't have a primary key ( as they are automatically linked to the Adno via the main form ). Unfortunately when several boys are filling in their own forms at the same time I keep getting error messages, one says that the data can't be updated and another says that there is a primary key problem.