Using Custom Form For Message Box

Jul 4, 2006

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

Exit_ProcedureName:
Exit Function

Err_ProcedureName:
MsgBox Err.Description, vbOKOnly + vbCritical, "Function Start Up"
Resume Exit_ProcedureName

End Function

View Replies


ADVERTISEMENT

Modules & VBA :: How To Pause Code When Calling Custom Message Box Form

Feb 9, 2014

I have created a custom message box form that suits my needs for this particular situation. It is called (opened) in the middle of a bunch of other VBA procedures. What I am having a problem with is how do I "pause" the rest of the code from running after the message box call?

For example, with a regular msgbox() function, once called, the code will wait for the user input or click of a button, then continue. My problem is that I am using the basic docmd.openform procedure, and it opens the message box form just fine, but then continues on with the rest of the code after the form is opened.

How would I "pause" the code after the call of opening my custom message box form, then continue it after the user clicks one of my closing buttons from that form?

Furthermore, although its not entirely needed in this situation, for future reference, how would I have that message box form return a value to the calling procedure?

View 14 Replies View Related

Displaying Custom Error Message

Nov 2, 2004

Good day to all:

I have created a database in access with multiple fields.

I have restricted to entering data a specific field with numbers only, but I would like to display a custom error message instead of the default access message. For example: "You can only enter a number in this field" and for another field; you must enter a name in this field if someone tries to ignore a specific field.

Any ideas on how to go about this?

Many thanks in advance,

Dion

View 1 Replies View Related

Custom Error Message On Create New Record

Sep 28, 2004

I have created a command button through the wizard that is basically:
DoCmd.GoToRecord , , acNewRec

Well, it puts all this code in the event:

Private Sub NewVerification_Click()
On Error GoTo Err_NewVerification_Click
DoCmd.GoToRecord , , acNewRec
InboundQuestions!Page1.SetFocus
VerificationNo.SetFocus
Exit_NewVerification_Click:
Exit Sub
Err_NewVerification_Click:
MsgBox Err.Description
Resume Exit_NewVerification_Click

End Sub

Well, my PK field is one users enter in manually (please don't ask why). What I need is something that checks to see if the number in that field is a duplicate key, so I can tell users via msgbox "Duplicate Number, try again". Right now, it's not that descriptive, it says "You can't go to the specified record". I guess all i need is an If statment, but I don't know the code that checks to see if [field1]'s value has already been used in my table. Any ideas?

View 4 Replies View Related

Forms :: Custom Message For Duplicate Entries

Aug 5, 2015

I have tried the code below, but I am not getting what I need. I have a table [Student Info] with a field [Student ID] as the primary key and many other fields. I added the Student ID field to my form, [Student Add]. When I input an ID that already exists I get an error code as expected but then my form still loads. I currently have a second form for updating student info [Student Update] for which I have a parameter form that asks for the Student ID. I would like to use just one form to add and update students if possible. So, if you add a new Student ID you can enter all pertinent data. However, if you enter a duplicate Student ID the form should populate with that student's information.

If I must have two forms (1 to add and 1 to update) and a duplicate Student ID is entered into the Add form, the user should get a message stating that the record already exists. Then, (Option 1) force the Add form to close without saving or (Option 2) give an option for opening the Update form. Either option is acceptable at this point because I am stuck.

When attempting to use the code below, I get a data mismatch error on the "Answer = DLookUp......" line.

Here's one I use on Social Security numbers for a pop up when a duplicate....
SS# is stored in table "tblApplicant"

Private Sub SocialSecurity_BeforeUpdate(Cancel As Integer)
Dim Answer As Variant
Answer = DLookup("[SocialSecurity]", "tblApplicant", "[SocialSecurity] = '" & Me.SocialSecurity & "'")
If Not IsNull(Answer) Then
MsgBox "Duplicate Social Security Number Found" & vbCrLf & "Please enter again.", vbCritical + vbOKOnly + vbDefaultButton1, "Duplicate"

Cancel = True
Me.SocialSecurity.Undo

View 14 Replies View Related

General :: Custom Message For When Record Locking Is Set?

Oct 20, 2014

My database has been set with the 'All records' locking option set to prevent two or more people editing files at once. This is working fine but I wondered if there is a way to make a more personal message appear instead of the default Access one, just to maintain a uniform look.

View 3 Replies View Related

Custom Pop-up Message When One Attempts To Add A Duplicate Record?

Dec 27, 2012

I would like to create a custom pop-up Message when one attempts to add a duplicate record.

Currently, I have a default pop-up message when you try to add a duplicate record. I set the field as Indexed= yes(No Duplicates) which generates a default pop-up message but it is technical and wordy. I would like to be able to simplify the wording to just let the user know not to add a duplicate record.

View 13 Replies View Related

Create 3 Custom Caption Buttons For A Message Box?

Nov 18, 2013

Is it possible to create 3 custom caption buttons for a message box?

I know I could do this as a form, but would like to know if it can be done in vba using msgbox...

View 2 Replies View Related

Custom Error Message For Duplicate Data?

Apr 26, 2013

How to create custom error message for duplicate data? I want this custom message at text box before_update event not at form_error .....

View 1 Replies View Related

Queries :: Display A Custom Message Box When Open Query?

Jun 20, 2013

I want to display a custom message box when I open my query. how to do this?

View 1 Replies View Related

Forms :: Replace 2105 Runtime Error Message With Custom Msgbox

Aug 6, 2014

Having set a table short text field to 'Indexed (No Duplicates)', I have a form which produces a '2105 runtime error' when the user attempts to submit a duplicate value. I would like to replace this default error message with a more user-friendly MsgBox.

My code for the SaveRecord button is:

Code:

Private Sub SaveRecord_Click()
DoCmd.GoToRecord , , acNewRec
MsgBox "Record successfully saved", vbOKOnly + vbInformation, "Record Saved"
End Sub

My code to capture the 2105 runtime error is:

Code:

Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 2105 Then
MsgBox ("This villa booking has already been logged.")
Response = 0
End If
End Sub

Unfortunately when the save button is clicked (when attempting to save a duplicate value), the 2105 error still runs. What are I doing wrong?

View 12 Replies View Related

Error Message When Trying To Use Custom Macro Built To Pull Text Data From A File

Jun 4, 2012

It is my understanding that a custom macro was built to pull text data from a file and import it into Access in the appropriate fields. This macro no longer works and will return the following error message:

"License information for this component not found. You do not have an appropriate license to use this functionality in design mode."

It only gives an option to click OK. When you do it shows a box called "Action Failed" that lists the macro name, condition, action name, and arguments with three button to click on the right of the box: "Step" "Halt" and "Continue". It appears that only the "Halt" button is available to be clicked.

Does this sound like an issue with the Access license or whatever license the macro might have? We're trying to decide if it's possible to restore the functionality of the macro.

View 14 Replies View Related

General :: One Form With Two Custom Ribbons

Aug 13, 2013

I have converted a 2003 database to the 2010 file format. In the 2010 database, I have created the USysRibbons table with 2 separate ribbons. One of the ribbons need to load depending on what the user chooses upon opening the database. I have a form that opens with the database and the user can either choose "Premium" or "Subsidy." I'm uncertain as to why the conversion will not replicate how the database works in 2003 but if I had to assume it would be because of the ribbons. I found a small piece of VBA that I think needs to be changed but I'm not sure to what or how. As of right now, I don't have a ribbon loading, just the form to load when the database is opened. Except I noticed that the "add-ins" opens the correct menu depending on which the user chose.

I actually went into Options--->Current Database--->Ribbon and Toolbar and selected a generic ribbon (File, which just has exit because it's the same whether the user selects Premium or Subsidy).

To clarify if needed, the user doesn't actually log in. The form that pops when the database opens has the drop down of either Premium or Subsidy. So really it goes like this:

Open database
Select Premium
Click Enter
Premium ribbon loads

OR

Open database
Select Subsidy
Click Enter
Subsidy ribbon loads

Technically, if I could have just the form pop I'd be cool with that because on the form there is an Exit Application button where the user could click and exit the database. When either the Premium or Subsidy ribbon is loaded, I already have an exit in the coding.

Public Sub openRegion(authority As String, region As String)
If (cboRegion.value = region) Or (region = "ALL") Then
'open region selected
If cboRegion.value = "PREMIUM" Then
loadPremium authority

[Code] .....

View 1 Replies View Related

Enable And / Or On Custom Search Form

Jun 9, 2014

I've created a custom search form where using unbound text boxes and combo boxes I enter the criteria for a query. I would like to enhance my form to allow "and" and "or" searches on a field. For example, a product on my database has multiple features. I would like to search for products who have "feature1 and feature 2" or "feature1 or feature2". {Note: The table, Product is connected to table, Features using table, LineItem_ProdFeature where there are multiple records in Features for one record in Product}

Right now, the search form has a combo box that lists all product features. The user selects a feature and runs the query. All products with that feature are listed in the query.

It would be so great if the user could choose multiple features from the combo box. Then the query would return all products that have all of the selected features ("and" search). It would be just awesome if the user could select multiple features, and specify if they want an "and" or "or" search of those features.

View 14 Replies View Related

Modules & VBA :: Custom Record Counter Of A Form?

Jan 27, 2015

I have a custom record counter on a form using the below code:

Private Sub Form_Current()
If Me.NewRecord Then
Me.lblRecordCounter.Caption = _
"Record " & Me.CurrentRecord & " of " & Me.Recordset.RecordCount + 1
Else
Me.lblRecordCounter.Caption = _
"Record " & Me.CurrentRecord & " of " & Me.Recordset.RecordCount
End If
End Sub

I think at some stage the form was saved with a filter on and this may be causing the issue. The problem I have is:

There are 1749 records. Everytime I open the form the custom record counter displays "Record 1 of 501". The built in record counter shows 1 of 1749. The moment I hit the next record arrow the custom record counter displays "2 of 1749" and if I go back again it displays "1 of 1749.".

I know it's a filter causing the problem because I have a macro that does a clear search. As soon as I hit the clear search the custom counter goes back to "1 of 501" again (even though the built in one stays at 1 of 1749).

I have Filter on Load set to No.

what I am doing wrong?

View 13 Replies View Related

General :: Creating Custom Menu Bar For Form?

Jul 2, 2012

i would like to create custom menu bars for my forms report

View 6 Replies View Related

Queries :: Custom Search Form Query?

Jan 28, 2015

I have made a database for work and is fully functional, but theres one thing I want to add but cant get my head around how to do it.

I have created a Form called 'Filtered Search', on the form it has multiple combo boxes for 'Auditors' 'Area' 'Status' and 2 text boxes for date range.

I want to be able to set what filters I want, and for the query to ignore any fields with no information selected/inputted (i.e. I want to see all records raised by "Mr Smith" (Auditor) that are still 'Active' (Status) in all areas at any time).

Names of items;

Table = 'Incidents'
Form = 'Filtered Search'
Report = 'Filtered Report'
Auditor = 'Combo7'
Status = 'Combo156'
Area = 'Combo5'
Date Range From = 'Text161'
Date Range To = 'Text163'

View 5 Replies View Related

Searching For Value Range On A Custom Search Form

Jun 9, 2014

I built a custom search form that uses unbound text boxes to set the criteria for a query. For example, I have an unbound text box, LastName on my search form. Then in the query, I set the criteria to Like "*"&[Forms]![SearchForm]![LastName]&"*". This returns all records if the text box is left blank or returns those records that match the text box if it isn't.

I would like to do the same thing but instead of searching a text field, I want to search a number field. And I want to search for a range of values aka >10 instead of just a single value. I still need the query to return all records if the text box is left blank.

View 8 Replies View Related

Custom Save Button On Form Preventing Subform

Jun 21, 2005

I have a main form and a sub form. Tbhidden and tbpropersave are the text boxes that govern the update procedure. The main form has two text box that i use to prevent the user from modifying the information on the main form without clicking my custom save button. the problem is that the subform should be completed after the information on the main form has been filled in. The Update code i have refuses to allow me to complete the subform without first clicking the save button on the main form. Here is the code. I wana be able to fill in info in the main form, then the sub form then click save. The sub form is a table which relates to the main form table Many to One.

Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_Form_BeforeUpdate

Me.tbhidden.SetFocus

If Me.tbPropersave.Value = "No" Then
Beep
MsgBox "Please Save This Record!" & vbCrLf & vbLf & "You can not advance to another record until you either 'Save' the changes made to this record or 'Undo' your changes.", vbExclamation, "Save Required"
DoCmd.CancelEvent
Exit Sub
End If

Exit_Form_BeforeUpdate:
Exit Sub

Err_Form_BeforeUpdate:
If Err = 3020 Then 'Update or CancelUpdate without AddNew or Edit
Exit Sub
Else
MsgBox Err.Number, Err.Description
Resume Exit_Form_BeforeUpdate
End If



Please HELP


End Sub

View 1 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

General :: How To Get Current User From Custom Login Form

May 2, 2014

how i can get a current user from a custom login form CurrentUser() this function always return a system user name admin as default. In my login schema i have a Hidden splash form that have a unbound field that holds user name from custom login form after login a dashboard execute and also display user name on dashboard according to user login ,this working fine for mine. Actually i want to make a currentuser stamp in every entry when a record is entered in database.

View 1 Replies View Related

Create A Custom Word Form Letterdoc From Access Data

May 13, 2005

For keeping record of provient fund, I have made a access/(or excel) database with many fields like ID, Name,contribution for months eg March, April,..to..,Feb,etc.It contains 50 records.

Now I have to print the provident fund statements of my 50 friends. This statement consists of some text language and some data(It is a word form letter document).The statement also shows some data which has to be calculated from the data of database eg grand total, cumulative total, interests etc.

Now I want to print the statement for all or selected no of people. What I want is to make the statement proforma in another excel sheet and then merge and print the statements for selected no of persons eg for ID 1 to 20, 50 to 70 etc. I do not want to make statement in MS word and do not want to merge it there, but I want to do it in excel just as we do in MS word mail merge.

Pl help me how can I do it in access/Excel? Can i calculate in word or should I calculate before hand in access before merging data?

View 1 Replies View Related

Forms :: Generate Custom Form Based On Query Results

Dec 11, 2013

I'm trying to track daily production at a manufacturing company running many different processes at different locations each running multiple parallel "lines." The tricky part is that the number of lines running and the shift schedules e.g. 2shifts 10hrs/day 4days/week or 3shifts 8hrs/day 5days/week change frequently for each process.

Right now I have a form for process data that specifies the schedule and number of lines running each day. Then I'm running an append query to a "production" table that generates blank production records associated with each item made in each process for the correct shift/line combinations.

Up to now I've been manually changing the date on the append query each time I run it. Then I have a seperate query for each process that pulls out the production records for each day. My problem is that the preferred interface for production data entry is a spreadsheet with the following layout:

--------DAYS LINE 1 DAYS LINE 2 SWING LINE 1 SWING LINE 2
ITEM 1 100
ITEM 2 2250
ITEM 3

which changes each time the shift/line schedule changes for each process. The only way to achieve this layout I know of is a crosstab query which isn't updateable. Ideally, each day the manager will specify the shift schedules and forms will be automatically generated with the correct structure and sent to the process supervisors. I'm open to different form layouts and even redesigning the database completely.

View 2 Replies View Related

Custom Input Mask Using Both Text And Numeric Characters For A Form

Feb 19, 2015

I am trying to create a custom input mask using both text and numeric characters for a form.

Example would me ABCD-12345678. However the first 4 letters would would need to be able to change.

View 2 Replies View Related

Form No Records Message Box.

Nov 2, 2005

Hello,

Am having a bit of a problem here. :(

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.

is their a way to do this?

thanks in advance!

View 2 Replies View Related

Error Message On Form

Jan 7, 2008

Hi all,

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.

View 3 Replies View Related







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