VBA OnClick -- Prompting User For More Than One Required Field

Jun 21, 2005

I'm using VBA to prompt users for two required fields. One I can do, but with more than one I get into issues like only 1 message box appearing at a time. If both fields are blank I want both messages to appear. Here's my code, it's in an On click function:

If IsNull(req_file_num) = True Then
MsgBox "Required field: File #. The appropriate file number must be entered before this PO's status can be changed to Filed."
GoTo Err_Command_158_Click2
End If

If Not [req_filed_date] Then
[req_process_status_rec_id] = 8

MsgBox "Your changes have been processed. This purchase order now has a status of Filed."
DoCmd.Close acForm, "frm_req_file"
GoTo Err_Command_158_Click2
Else: MsgBox "Required field: File Date. The appropriate date must be entered before this PO's status can be changed to Filed."
GoTo Err_Command_158_Click2

End If

Err_Command_158_Click2:
End Sub


I realize that it only shows one message box because I have the GoTo Err_Command_158_Click2 command, but I couldn't figure out how else to keep it from continuing through the code. If both "req_file_num" and "req_filed_date" are null, then I don't want the "req_process_status_rec_id" to change to 8 and have the form close.

Thanks for your help!

View Replies


ADVERTISEMENT

Modules & VBA :: Prompting User To Select Answer

Aug 7, 2013

I'm trying do a Select Case on a form control where the user is prompted for information depending on the value in the control.

Here's a generic example:

If field1 = "Vegatable" then
Select 1 for Brocolli
Select 2 for Lettuce
Select 3 for tomato

If field1 = "Fruit" then
select 1 for "Banana"
select 2 for "Apple"
select 3 for "Peach"

View 9 Replies View Related

Prompting User To Accept Or Decline Potential Duplicates While Importing Excel Table?

Jun 28, 2013

I have a database table to which I will be adding multiple records from various other contributors. I would like to build a simple, import-friendly excel table that I can mail out to others, so that they can fill it out and send it back to me. Then I will save import steps as a macro or something similar, so that I can easily import their data.

The hard part is that I would like a way for Access to compare the new records with the existing records, identify potential duplicate records by predetermined criteria (in other words, 'wild-carded' to some level of specificity, since duplicates could be off by just a few characters), and then prompt me to examine each record to be imported alongside however many existing records that have been identified as potential duplicates. Then I as the user could:

1. accept the import record as a new record

2. decline importing that record since it is a duplicate of an existing record, or

3. edit by hand an existing record that is a duplicate of the proposed import, but may require additional information, and then decline to import the new one.After each prompt, I would like the import process to continue to the next potential duplicate, and when there are no duplicates, to complete the import and display a message box that says "Import complete".

View 6 Replies View Related

Editing A Field OnClick In A Form

Jul 26, 2005

I have a button in a form that needs to change the text in a field named idStatus from "Assigned" to "Returned"

I have tried using an expression like this "[Form]![Field]=12" in the OnClick spot but it returned an error. There is no "custom made" wizard for this and my VB skills are lacking.

Once again, thanks! (I know I post alot but this forum is amazing!)

View 1 Replies View Related

OnClick Field Input Date

May 19, 2006

Hi All
Does anybody have or know how to make a field so when its clicked it will enter todays date, the default value =date() is not an option either.

Thanks for any help

View 1 Replies View Related

Onclick Setiing Field Color

Dec 20, 2006

How do I use onclick to change the background color of a field in a form? and to return the field background color when the field is not selected?

KMB

View 3 Replies View Related

Forms :: Using OnClick Event To Open Query Text Displayed In Form Field?

Oct 10, 2013

I have a table that holds the SQL texts for ca. 1000 Select queries (mostly minor variants that are used to programmatically swap out RowSource strings for combo boxes). I'd like to have a quick and easy way to open/review/modify these queries.

One strategy would be to display the SQL strings in a field on a Datasheet form, then use an onClick event on a text box linked to the SQL-holding field (or perhaps an onClick event tied to an unbound text box on the form) to open the associated query. That would allow me to view the SQL of the query that I want to open, allow me to quickly scroll through the list of stored SQL texts, and give me options for sorting or limiting the SQL-texts displayed in the datasheet form.

But, I can't seem to get the onClick event to work. The problem seems to be that I can't figure out how to pass the SQL string contained in the field to a function that will use that string to open the query .

View 10 Replies View Related

Modules & VBA :: Unbound Form - Selecting Label OnClick Does Not Recognize Changed Form Field?

Feb 5, 2015

Access 2007
Unbound Form

I have a onclick tied to a label (for decoration purposes) that when clicked it launches VBA that essentially updates a form. All that part works except it will not recognize any changed value of the field I was last in?

Just to try to explain best as I can what happens.

- Form gets opened
- I change field (quantity field)
- I click the Label
- It reverts to pre-existing value.

if I click off of the text field first then do the onclick - it recognizes just fine.

View 7 Replies View Related

Making A Field Required Based On Value Of Another Field

Jun 18, 2015

I am trying to do something that I would think is very simple but I'm having a hard time with it. I have a form that consists of questions that the user is needed to answer. It displays the question, a combobox where the User can select 'Yes' or 'No', and a textbox where the user can input their comments. What I would like to do it the following: if the user selects 'Yes' as an answer, I want the corresponding comments box to be required.

View 10 Replies View Related

Prompting For Parameter - Why?

Dec 12, 2005

Hello,

I have a table which contains:

InvNo - Autonumber (invoice number)
AccNo - Clients account number
Amount - Amount of invoice

I also have this data (minus the InvNo) in a linked spreadsheet. I would like to keep the spreadsheet as it is all set up for the printing of multiple copies etc.

The idea is, I want to import the data from the spreadsheet into the database, which will then apply an invoice number (because it is an autonumber), and then get that invoice number back into excel.

I have done it all, but cannot get it to give me the invoice number assigned to it.

I thought I would have a simple query that looks for records in the table that are the same account number, and amount (plus a few others I havn't included here), and then it could return the InvNo.

But, whenever I run the query, it asks me to specify the parameter, it doesn't seem to be able to read from the linked spreadsheet (it is openable, I can open it in access just fine).

In the query I have put (under criteria): "[LinkedSpreadsheet]![AccNo]" (and similar for the other fields I want to match).

What is wrong?

Thank you!

View 1 Replies View Related

Prompting For A Date?

Feb 17, 2005

Can I get my query to prompt for a specific date somehow?

Or....I am running a report off my query, can I get my report to prompt for a specific date?

View 1 Replies View Related

Prompting A Crosstab

Nov 14, 2007

I have a crosstab query and I want to prompt users for certain colunms is this possible. If so how, I want to prompt the users to enter month.

View 2 Replies View Related

Required Field

May 8, 2006

Hi. I want to have all my fields on my form to be required and so that the user cant close the form if they are empty (error message). In the table properties I have them set to Required an have tried putting in a validation rule of IS NOT NULL but it still dont work. any help appreciated. thanks

View 1 Replies View Related

Required Field

May 8, 2006

Hi. I want to have all my fields on my form to be required and so that the user cant close the form if they are empty (error message). In the table properties I have them set to Required an have tried putting in a validation rule of IS NOT NULL but it still dont work. any help appreciated. thanks

View 1 Replies View Related

Prompting For Specific Dates

Aug 16, 2005

Hi all
Im wanting to open a sales report, but I want to be prompted to enter dates FROM and TO so that I can get specific sales.

Example

"Enter start date" here i'd enter 1/8/05
"Enter end date" here i'd enter 31/8/05

that way i'd get all sales throughtout august. Then when september comes round I could enter new dates and save me having to go in and change the filter.

Can anyone help?

Thanks

View 3 Replies View Related

Required Field Dependant On Another

Sep 12, 2006

Quick question for you.
I know how to set a required field, but how do I edit two field so that they are dependant on each other? IE. How do I set my form to make FIELD1 required ONLY if FIELD2 is empty and vice versa?
Thanks very much and I hope I've explained myself correctly.

View 1 Replies View Related

Required Field... Simple

Jun 23, 2005

I can not for the life of me figure out how to make one field required. The name of the field on the form is Selectee. Can someone help?

View 2 Replies View Related

Required Field If Enabled.

Aug 7, 2006

After some suggestions, I have a form with combo boxes, the combo boxes are set to enabled "no", but become enabled by an after update command on another field.

The after update command works perfectly, however once enabled I need to ensure data is selected, as opposed to leaving blank.

Any ideas on the best/easiest way?

View 14 Replies View Related

Required Field In Form

Nov 3, 2004

I have a form that users update, but they continue to leave this one field blank and I have to go behind them to enter this date.

Field Name: OrigProcDt

This is a date field

I don't want this field to be a required field in the table, because it won't stop it anyways.

The record is already added by the clerical staff, the other users just update the record when it's time to.

The problem is that they need to enter a date in this field before leaving the record they are updating.

Any help would be appreciated.

View 2 Replies View Related

Required Field Allows Non-entry?

Aug 29, 2013

Some records that users are inputting through a form are coming back blank in fields that are required. how do I fix?

View 3 Replies View Related

Forms :: Fields Are Required To Be Filled Out Even Though Not Set As Required

Nov 3, 2014

I have made a form based on related tables. it requires me to fill out every field, which I don't want. I didn't make them required. Why does it do that?

View 3 Replies View Related

Reports :: Expr1 In Query Keeps Prompting

Oct 24, 2013

I have a for form with a button to run a report. The report runs a query. The query reads data on the form to feed the report. The data that is from the table works fine but data from a text box on the form will not. It prompts for EXPR1.

In my query I have the following:

EXPR1: [Cnum]

[Forms]![FRM-Customer]![Cnum]

where FRM-Customer is the form with the button to run the report and Cnum in the text box data that I want to pass to the report. Every time I run it it prompts Cnum?

View 5 Replies View Related

Parameter Prompting Multiple Times?

Aug 15, 2011

I have a report with a subreport. I have added a parameter to the query to prompt for [manager] or is null to get all managers. However, on the report when I enter a manager my count on the subreport still returns the count for all. So, I added the same prompt to the query for the subreport. It returns the right count, however, it prompts for the manager multiple times. How do I get it to prompt only once yet get the right total?

View 1 Replies View Related

Using Validation Rule To Set Field To Required

Feb 11, 2006

How can I use the validation rule to set field to required instead of checking required field, because I wish to customize the prompt message.

Thanks.

View 2 Replies View Related

Only The Month Required From The Date Field

Nov 8, 2005

Hello everyone

I am wanting to pull out only the month part from a date field, 11/10/2005.

In the query I have made an expression to pull the month, eg 10 for October.

I need to convert this number of the month to the Title of the Month.

I made a combo box on the report based on the Expression and in the row source put

1,"January", 2,"February",3, "March", 4,"Apri", 5,"May", 6,"June", 7,"July", 8,"August", 9, "September", 10, "October", 11, "November", 12, "December"

Unfortunately it still comes out with the number of the month.

Can anyone tell me please where I am going wrong.

Thank You in advance.

View 2 Replies View Related

Required Field Error Message

Feb 26, 2005

I have form "Project Log" for my table "Orders". One field "OrderTakenBy" ( text field) is a required field in the table.

In the field properities of OrderTakenBy in the Before Update event I have used the following code:

Private Sub OrderTakenBy_BeforeUpdate(Cancel As Integer)

Dim strMsg As String, strTitle As String
Dim intStyle As Integer

If IsNull(Me!OrderTakenBy) Or Me!OrderTakenBy = "" Then
strMsg = "You must enter your name."
strTitle = "Field Required"
intStyle = vbOKOnly
MsgBox strMsg, intStyle, strTitle
Cancel = True
End If
End Sub

When I first tested it, after trying to leave the field without making an entry-it worked great. Now it seems to have stopped working, I get no message when I leave the field empty.

View 1 Replies View Related







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