Modules & VBA :: MessageText Argument To Be Auto-filled With Whatever Value Combo Box In Form Holds

Jun 28, 2013

I want the MessageText argument to be autofilled with whatever value the combobox in the form holds. This is my code so far...

Code:
Private Sub Command54_Click()
Dim EmailText As String
EmailText = "Submitted By: " & vbNewLine & vbNewLine & "Description: " & vbNewLine & vbNewLine & "Subject: "
If Combo18.Value = 1 Then
DoCmd.SendObject acSendNoObject, , , "knagel@durablepackaging.com", , , , EmailText, True

For instance, after "Submitted By: " I want the value from the combobox: Submitted By in the form to be automatically placed there.

View Replies


ADVERTISEMENT

Modules & VBA :: If Date Filled In Field / Then Combo Box Should Have A Certain Value In It

Mar 2, 2015

I try to create an error message if a user fills in a date field and leaves a combo box with wrong value.I have no clue how to use "Is Not" to check the combo box.The date field that will be filled in is called "Sent to Check" and the combo box is called "Status Case" and the value should be "Sent For Check" If the value in the combo box is different, then the back ground should change to red and get a message.This is the code I have so far that does not work:

Code:
Private Sub Test__date_started__AfterUpdate() 'XXXXXXXXXX working onXXXXXXXXXXXXXX
If Not IsNull(Me.[Sent_To_Check] And Me.[Status_Case] IsNot "Sent For Check" Then
MsgBox "Status Case be set to Sent For Check!", , "Incomplete Form!"
Me.[Sent_To_Check].BackColor = RGB(255, 0, 0)
Else
Me.[Sent_To_Check].BackColor = RGB(255, 255, 255)
End If
End Sub

View 2 Replies View Related

Modules & VBA :: Text Column Holds Value Of ID

Feb 22, 2015

I have a table Actions as follow

Action ID Action
1 cutting
2 sowing
3 ripping
.. ..

At some time , on clicking the button that opens this lookup table I found some of the values of Action equal to Action ID

Action ID Action
1 1
2 sowing
3 3

What are all possible scenarios that would lead to Action column taking value of Action ID?

View 9 Replies View Related

Modules & VBA :: Not Allow Form Close If Date Not Filled In

Feb 24, 2015

I have a problem when I close a form to stop it from closing if a date is not filled in.

If the field "Case_Status" is filled in with "response received" and the date field "response_received_date" is blank, it shows a message and fils in the text box with red background.

It simply fails to keep the form from closing till the date is filled in. Code I have so far:

Private Sub CloseForm_Click()
If Me.Case_Status = "response received" And IsNull(Me.response_received__date_) Then
Me.response_received__date.BackColor = RGB(255, 0, 0)
MsgBox ("Please fill in manatory fields!!!")
DoCmd.CancelEvent
Else
DoCmd.Close
End If
End Sub

View 12 Replies View Related

Forms :: Short Time Within Auto-filled Text?

Aug 14, 2014

I have two fields that are in short time format, and are saving the information to the table in short time format.

I then have a field that I have set to auto-fill under the chosen circumstances, with a text roughly as follows

Code:
Dim Story As String
Dim IDepTime
DimADepTime
IDepTime = [InstructedDeparture]
ADepTime = [ActualDeparture]
Story = "This person was instructed to leave at " & IDepTime & " but did not do so, instead departing at " & ADepTime & "which caused us a problem"
me.txtnarrative.value = Story
End Sub

This all works, however the times being displayed are in hh:mm:ss format, when I only want hh:mm format - how do I tell it the format I want?

View 1 Replies View Related

User Login And Have Their INITIALS Auto-Filled When Filling Out Forms

Apr 17, 2013

I have a database where multiple users log in and work in 1 of 2 different forms. The 1st form in for initial data entry where users enter data then senter there initials and save each record. the other form is for QC'ing data that has been entered and they will add additional data to the form, then enter their initials and save the record.

How can I make it so that I can have a user once they log in to the database, it will autofill their initials? I have used a dropdown box before but it is not useful for people who have the same first name initial or worst, the same first and second initial because they end up selecting the wrong initials.

I do not currently have it set up where I have a login screen, I just have only forms visible to users when they enter data. Any easiest way to go about making this happen (I am just trying to shorten the amount of data entry that gets done).

View 9 Replies View Related

Modules & VBA :: Color Row In Subform If Value Filled In

Mar 19, 2015

I created a subform in side a form where I have some data. The idea is to fill in the row with a color if a value is met, like "Reset".Conditional format is working (for one field), but in Access 2003 I can only have 3, and I have like 6 values to choose from.I use the below code to no avail:

Code:

Option Compare Database
Private Sub Form_AfterUpdate()
If Me.Legend = "Reset" Then
Me.Legend.BackColor = vbRed
End If
End Sub

View 1 Replies View Related

Forms :: Opening A Form From Another Form Via Combo And Auto Loading Form Data?

Apr 14, 2015

I have been tasked with creating a tool to analyse mobile phone bill data and present the analysis, and our recommendation, to a customers. Being new to Access (other than basic tuition) this has been a slow uphill task, which is finally nearing completion, however there is a problem which I have not yet been able to overcome.

The requirement is for the DB to open first on a splash screen (lets call it Form A) with fancy picture where our customer is selected from a combo box, the customer is then telephoned, a linked computer screen is established and our staff then click "Go" to proceed to a second form (Form B) showing an account overview and more details.

The problem I have is when "Go" is clicked, the second form loads via on click event, and even populates the correct customer in its combo box. Unfortunately that is as far as it gets - the combo does not look up the information. The customer needs to be selected again for the subforms and subreports to load with the customer overview. To clarify, form B just sits there blank until the customer is re-selcted from the combo box in form B.

View 9 Replies View Related

Modules & VBA :: Argument In Custom Function

Jun 6, 2014

I'm having a problem with argument in custom function..My table is like this:

myValues
123.5
32.7
65.8
11.1

What I want to achieve is to multiply each value with the average of all values, so that at the end I get (avg(myValues) = 233.1):

myValues2
7196.963
1905.593
3834.495
646.8525

For this I would like to have a function (this is simplified example of bigger problem, that is why I need function, otherwise simple SQL would suffice as mentioned below also), so that I could do something like this:

'SELECT TestFn([myValues]) as myValues2 From MyTable' or
'SELECT TestFn("[myValues]") as myValues2 From MyTable'

and I should get the table above.

My code is like this

Code:

Public Function TestFn (FieldName) as String
Dim myAvg as Double
myAvg = Davg(FieldName, "myTable")
TestFn = FieldName * myAvg
End Function

I understand the problem is that Davg needs string, but if I change to string then the multiplication does not work. The 'FieldName' parameter does not have a Type specified because that is where the problem is if I give string Avg works ,but calculation does not. If I give Number, avg does not work.

P.S. "as String" at the end of function is not a mistake, I need number as a string

P.P.S I did not inculde NZ either as in my example it can never be Null.

View 8 Replies View Related

Modules & VBA :: Function Not Returning Argument

Jan 13, 2015

I have just added a function to a database to strip out any commas or quotation marks from a passed string.

However, it is returning a black string even though when I step through the function it creates the out string correctly and the variable "OutString" is populated when the Exit Function command is executed.

Calling code.
InString = Btxt
OutString = ""
Call Strip_String(InString, OutString)
SBtxt = OutString

[Code] .....

View 4 Replies View Related

Modules & VBA :: Drop Table Using If Argument

Oct 1, 2013

1) I want to figure out how I can drop a table using "if argument". If the table exists then drop table, if not exists do something else.

2) I want to figure out (ALSO) how I can drop a column using "if argument". If the column exists then drop column, if not exists do something else.

I wrote something but is not enough..I can't find more clear information about that.

Function first()
On Error GoTo Macro1_Err
Dim BD1 As Recordset
DoCmd.SetWarnings False
Set BD1 = CurrentDb.OpenRecordset("BD_example table")

[Code] ....

View 8 Replies View Related

Modules & VBA :: Shell And Invalid Procedure Call Or Argument

Feb 23, 2014

I have a form with a button to print preview a report. This report needs one input parameter before executing. The computer this will run on is a touch screen and does not have a keyboard. Windows 7 has a "on screen keyboard" program. I want this to run first so that my user can input the parameter.

I have the following which throws an "Invalid procedure Call or Argument"

Sub CallTeclado()
Dim RetVal
RetVal = Shell("c:windowssystem32osk.exe", vbNormalNoFocus)
End Sub

View 4 Replies View Related

Modules & VBA :: Public Function - Giving Control Name As Argument

Oct 22, 2013

I am designing a Public Function F()

I want this function to populate value from a any field selected from any table to any text box in any form ...... Lets say in a Database named TestDB we have a Table named tblTest , a Form named frmTest and in this form( frmTest ) we have one Bound Combo Box named cmbTest and one unbound TextBox named txtTest

We assume that the table tblTest has three fields : TestID , FName and LName .

We also assume that there are already some records in the Table tblTest .

If the function F() is already programmed it should take as arguments as it follows :

F(FormName as??? ,ControlName as ???, TableName as ???, FieldName as ???, ID_Field_Name_of_the_Table as ???, Combo_box_selected_ID as ???)

In result the function should (probably) DLookup (FieldName , TableName , ID_Field_Name_of_the_Table = Combo_box_selected_ID ) and then store the value in a variable ( probably Variant ???) , lets say called varSetValue.

The problem is IF this is the correct way to handle that issue , than what should i do next.... I really don't know how to pass a Control's name to a function from the Event module of the ComboBox -

I mean - how can I obtain the value so it is usable for the function .... What data type should be the function arguments so I can use them to set a value for a control in any form .

In example : If the Dlookup() is somehow successfull then I want to assign the varSetValue to the txtTest what should I do : FormName.ControlName.Value = varSetValue >??????

I have read a lot materials but couldn't find a good answer for that , and aswell what data type should be the arguments that the function accepts and how do I obtain Controls and Forms names so I could use them in the function as described above .

View 4 Replies View Related

Modules & VBA :: Invalid Procedure Call Or Argument Using Shell Command?

Feb 6, 2015

I'm developing an application where I want to call the keyboard up on the screen when a user enters a field. This is my setup:

Windows 8.1 32 Bit, Access Runtime 2010.
Exact lines of code are:

Dim RetVal
RetVal = Shell("C:Program FilesCommon Filesmicrosoft sharedinkTabTip.exe")

These lines of code work perfectly fine on my development PC which is running Windows 7 64 bit, Access/Office 32 bit.

I know the path to the exe is good. I can navigate and double click it and it works great. but the shell command is resulting in the invalid procedure.

View 4 Replies View Related

Forms :: Auto Pop / Fill Based On Combo Box In A Form

Oct 22, 2014

I have created a form based off of one table. I have added an unbound combo box so a user can select a department's number and would like department name and accountable officer to auto pop/fill based on the dept number selection. I'm not sure what I need to put in the "After Update" in the properties in order for this to work.

View 5 Replies View Related

Auto Fill Fields In A Form Using A Combo Field

Mar 21, 2012

I am trying to auto-fill address info from a combo field. I'm using a select query on a table for the information. It appears to work for the first field (Firm Address1), but then stops working on all the other fields.

View 3 Replies View Related

Modules & VBA :: Invalid Argument With Search Box - Missing Space Or Quotation Marks

Mar 25, 2014

I found this code on a website that uses a form to search all tables in my database. Problem is that when I click "search" I get an invalid argument error. I am guessing that there is a problem with my SQL string. Missing space? Missing quotation marks? etc etc.... Anyway, here is the code:

Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim rs As DAO.Recordset
Dim strSearch As String
Dim strTableName As String

[Code] ....

View 1 Replies View Related

Modules & VBA :: Unable To Get All Records By Excluding Numrows Argument In Getrows Method?

Jul 31, 2014

Why I am not able to get all records by excluding the Numrows argument in the getrows method?

Sub Test2()
Dim myrset As Recordset
Set myrset = CurrentDb.OpenRecordset("SELECT * FROM Holidays;")
myrset.MoveLast
myrset.MoveFirst
MsgBox Excel.Application.WorksheetFunction.Networkdays(#8/1/2014#, #8/31/2014#, myrset.GetRows(myrset.RecordCount))
MsgBox Excel.Application.WorksheetFunction.Networkdays(#8/1/2014#, #8/31/2014#, myrset.GetRows())
End Sub

Second MessageBox is giving a wrong value.

Is it a mandatory one? Or Do I have to do some ritual like (Movelast) before that?

(Holidays table is just having the values in the array only ie. #08/15/2014# and #08/29/2014#)

View 10 Replies View Related

Forms :: Open New Form With A Specific ID (or Name) Filled In

Feb 4, 2014

(MACROS ONLY)I am looking for a way to open a form in order to add a new record. The idea is that I open up the form with a MemberID and possibly the name already filled in on the relevant form. It is merely for ease of use regarding the user.

I have got as far as opening the the new entry form. I just need to pass the MemberID into the relevant field. If I use the wizard it is just finding a record of a pre-filled entry.

View 7 Replies View Related

Open A Form With A New Record With Selected Info Already Filled In

Sep 29, 2006

Hi again,

One last one that's been niggling me - I just can't fathom the code... I bet it's very simple...

I have a Form ("frmJobSummary") that shows all the jobs for a customer - the customer is selected and the Customers ID is stored in a Control called "CustomerID" (It's just a number)

I have a button that opens up a new form... "frmEditJob" This allows you to add a job to a customer. I know how to get it to open up as a new record... but...

How do I get it to open up as a new record (or job) for the customer selected on the form "frmJobSummary"?

Here's the code so far... all it does is open the form with the Current record. :(

Your help is, as always, most appreciated!

Private Sub OpenNewJob_Click()
On Error GoTo Err_OpenNewJob_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmEditJob"

stLinkCriteria = "[CustomerFK]=" & Me![CustomerID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_OpenNewJob_Click:
Exit Sub

Err_OpenNewJob_Click:
MsgBox Err.Description
Resume Exit_OpenNewJob_Click

End Sub

View 3 Replies View Related

Forms :: Populate Textbox Based On Others Within Form Being Null Or Filled

May 24, 2013

I am fairly new to Access and trying to populate a text box based on whether other textboxes throughout the form contain a date or are null, so as I update the progress of work the textbox that I have located in the header will indicate the status of work flow, this is what I thought might work but I seem to be doing something wrong.

Code:
Private Sub Form_AfterUpdate()
Status = IIf([Date_Raised] Is Null, "New", "")
Status = IIf([Date_Raised] Is Not Null, "Open", "")
Status = IIf([Approved_Date] Is Not Null, "Approved", "")
Status = IIf([Actioned_Date] Is Not Null, "Actioned", "")
Status = IIf([Tested_Date] Is Not Null, "Tested", "")
Status = IIf([Closed_Date] Is Not Null, "Closed", "")
End Sub

View 2 Replies View Related

Forms :: Field Filled With Day Of Week Of Specific Date In Form

Mar 24, 2014

I have 2 fields in my form.. on if for date (date picker)..

The other one is for day..

I am using this atm:

Code:
Private Sub okt_courtdate_AfterUpdate()
okt_courtday = Format(okt_courdate, "dddd")
End Sub

So.. after i pick my date.. when i click tab.. the day field in form will be filled with correct day of that date.. The problem is..

I want to change days to my countries language.. example if it's monday, i want it to be "isnin".. I need to do this for all 7 days of the week.

View 2 Replies View Related

Forms :: Main Form Opening Subform In Add Mode But One Field Is Already Filled

Jul 20, 2015

I'm using Access 2007. I have a few problems:

1. I have a switchboard. I want to click a button, that opens a form with a dropdown list, when I make my selection, it opens a subform in add mode, but the linked field in the subform isn't empty, but filled with the mainform's field value that I selected?

OR

2. Is there a way for me to open a form in add mode, add data to it, click the add button (I will add an add button) that allows me to add again, but this time a particular field is not empty, but filled with selected info from previous selection?

Say for instance, I have 2 fields (both combo box fields), I click add, made selections for both fields, I click add again, but this time one of the fields stays constant like it's already been selected. It's filled with what was selected from before.

Either of those 2 - which ever is simpler.

View 4 Replies View Related

Modules & VBA :: Auto Click Textbox On Form?

Jul 10, 2015

I have a form which contains a textbox called Expire_Date.

When the form is running, the contents of the [Expire_Date] txt box triggers

Some vba to populate another textbox [Flag] with "Valid" or "Expired" based on the date in [Expire_Date].

Textbox [Flag] is conditionally formatted but will only change if you click on the [Expire_Date] field.

Is there a way to use vba to click this field for each entry as there are multiple?

View 1 Replies View Related

General :: Open Word Document With Corresponding Data Filled From Text Field Of A Form

Jul 10, 2013

I am trying to open a word document with corresponding data filled from the text field of a form. I managed to get the word document but I don't know how to give a variable in word document.

View 2 Replies View Related

Modules & VBA :: Disabling Auto-formatting Of Controls In A Form?

Jul 14, 2014

I have a problem with formating controls in a form. As a example, I inserted a tree view control and adobe reader control. After I've resized them manually in a design form, I switch into form view and they both resize automatically to their own size (don't know where it gets from).

In the result, I can't obtain the required width and height. How can I make them resizable to my own preference?

View 14 Replies View Related







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