Modules & VBA :: OnLoad Event To Change Icon Of The Form

Sep 26, 2014

I currently use code in a module and code on each form in the on_load event to change the icon of the form.. the code i use is as follows..

in a module:

Code:
Private Declare PtrSafe Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Const WM_SETICON = &H80
Private Const IMAGE_ICON = 1
Private Const LR_LOADFROMFILE = &H10
Private Const SM_CXSMICON As Long = 49
Private Const SM_CYSMICON As Long = 50

[Code] ....

And on each form on load:

Code:
SetFormIcon Me.hWnd, "k: est directoryhsicon.ico"

What I am wondering is would it be possible to store the .ico file within the DB file itself (i know access can store bitmaps) and reference the .ico in the form load event code?

Overtime the db file will probably move to its own dedicated storage so using a direct reference to the file wont work..

I have tried the following but get an error (it tries to reference the .ico file as to being in the root directory of the db file)

Code:
SetFormIcon Me.hWnd, Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name))) & "hsicon.ico"

View Replies


ADVERTISEMENT

Modules & VBA :: Set Default On Control In OnLoad Event

Nov 17, 2014

I am dynamically trying to set a control default value. I have the code below in the On Load event of the form. I get an error msg that says "Run-time error '2467': The expression you entered refers to an object that is closed or doesn't exist."

Forms(mainform)("Dyn_" & Trim(str(Project_ID)) & "_SubFrmTab03" & PT_Suffix & "_Approval").Controls("Groupid").DefaultValue = "=Forms!" & mainform & ".ClaimInfoGroupID"

View 3 Replies View Related

Forms :: Onload Event - Open A Form And Update Caption Of A Label

Apr 15, 2013

I have some code on a button that opens a form and changes the caption of a label:

Code:
DoCmd.OpenForm "frmRepair", , , , , , "CancelNo"
Forms![frmRepair].Form.[lblmain].Caption = "Missing Parts"

This code works well and frmRepair opens with the updated label caption. The original value was "Return/repair Information"

A few other things need to change on frmRepair depending on this caption as well as the values of some other fields, so I use the following code in the onload event (although I later tried the onopen even)

Code:
'Disable labels button if there is no RMA and the item is a repair
MsgBox Me.lblmain.Caption
If Me.lblmain.Caption = "Return/Repair Information" Then
Me.txtRMA.SetFocus
MsgBox Me.txtRMA.Text

[Code] ....

However, I cannot get this to work as the "if" statement always returns "Return/Repair information" and not the modified caption. The message box confirms that this is the case.

I suspect that this has to do with the point in time that the frmRepair loads or opens and when my code enters the modified values.

View 13 Replies View Related

Modules & VBA :: Use Text Box Change Event To Determine Form Format

Sep 23, 2013

Had a combobox so the user could choose between two data entry formats.They don't want the combobox, they want the user to enter data into one or the other textbox - and that choice to trigger the format.Two groups of text box - group 1 has a single text box - group 2 has three text box. When the user selects a text box and types the first character into it. This triggers locking out the other group choice and enables the <Validate and Edit> command button.

If the user backs out (deletes) the text in a text box.It basically makes both groups available again and it disables the <Validate and Edit> command button.Basically, if the text box Change event counts a character, it changes the text box Tag to "Bust". Then it calls a common routine that checks both text boxes.The choice won't take place if the textbox gets focus. It changes if a text box has 1 or more character typed in.

Code:
Sub WhosOnFirst()
' two groups of Required field - if one textbox in a group has a character entered first
' that group becomes the Format - enables the <Validate and Accept> button that will take the next setp

[code]...

View 2 Replies View Related

Forms :: Change Form Icon Next To Caption?

Jun 12, 2014

how to change a form icon and make that icon embed to my database, I have tried the Application Icon property in Access Options but when I copy the database to other computer then the icon disappeared.

View 3 Replies View Related

Date Comparison OnLoad Javascript Event

Aug 10, 2006

Okay, me again, on my DAP (Data Access Page) I have a piece of JavaScript that tells my page onload compare 2 dates. It's straight forward and all and my code works. That's actually where the problem is... When access loads my DAP up it builds the page, executes the javascript and THEN populates my fields with all the records. So my comparison javascript will always execute BEFORE the data loads into my DAP...


<body language=”javascript” onload=”colorBox();”>

<SCRIPT LANGUAGE=”javascript”>
Function colorBox(){
If (Quarter1DueDateP1 >= Quarter1CompleteddateP1){
Box3.{background-color:Green;}
}
Elseif (Quarter1CompleteddateP1>=Quarter1DueDateP1){
Box3.{background-color:Red;}
}
Else {
Box3.{background-color:Yellow;}
}
}

View 1 Replies View Related

Forms :: Onload Event Doesn't Run All The Time

Aug 16, 2015

I have a form with an onload event that apparently only runs when it wants to. I've checked the onload property on the form and it is set to event procedure. Went through the code on the event and everything looks good. When i mark it in break mode and step through it it runs fine. When I take the marks off it sometimes works and sometimes doesn't.

View 6 Replies View Related

Data Access Page Onload Event Problem

Aug 8, 2006

This behavior is driving me crazy!

I have a data access page with an onload event for the window. All I want to do is go to a new record, update a date field with today's date and save the record. Here is the code:

<SCRIPT language=vbscript event=onload for=window>
<!--
window.MSODSC.CurrentSection.DataPage.NewRecord
request_date.value=DateValue(Now)
MSODSC.DataPages(0).Save()
-->
</SCRIPT>

When I load the page, I can see the date pop into the request_date field, but then it disappears. I made sure the value update code works by putting it on a different object's click event. The problem is when it's in the onload event for the window.

Is there something I'm missing about this event that prevents this from working? Thanks!

View 2 Replies View Related

Forms :: DLookup With Linked Tables - OnLoad Event

May 26, 2015

The image below describes the scope of the issue.

The function is called upon in the onLoad event of frmMain.

View 3 Replies View Related

Modules & VBA :: Text Box Change Event Prevents Updating?

Jun 18, 2013

Currently I have an issue where on of the fields in a userForm will not update. I have tracked down the problem to an update Event procedure

Code:
Private Sub txtRate_Change()
Me.txtSales = Me.txtRate * Me.txtPages
Me.txtGST = Me.txtSales * 0.1
Me.txtTotal_Inv = Me.txtSales + Me.txtGST
End Sub

The idea being, when you update the rate, the Sales/Revenue figure will update based on that rate. For a while this seemed to work fine. but recently , it just will not allow me to update the field txtRate, I cannot understand why. I have now replaced the _Change() event for a _LostFocus() event. but I am not sure that is as reliable, and I am still puzzled / worried as to why the _Change event will not work.I'm on Access 2013, win 7 , using a front end db connected to the back end using linked tables.

View 8 Replies View Related

Modules & VBA :: Beforeupdate Event Undo Change To A Combo Box?

Oct 7, 2013

I'm working on a bit of code that before a combobox is changed checks with the user to confirm that they want the change to go ahead, if yes a recorded is added to a table

This all work fine apart from if no is selected - I am trying to get the combobox to undo the change however when you select no the msgbox pops up fine but the combobox does not undo

Can't see where I'm going wrong I thought undo worked for comboboxes

Code:
' Displays a message box with the yes and no options.
Response = MsgBox(prompt:="Do you wish to change the status of this Job? 'Yes' or 'No'.", Buttons:=vbYesNo)
' If Yes button selected
If Response = vbYes Then

[Code] .....

View 3 Replies View Related

Modules & VBA :: Change Which Row In Combobox Is Visible Depending On Event

May 21, 2015

I have a combo box with three columns, the first one is the bound one, the second is text in English, and the third is text in Spanish. Currently when the form is open, both the English and Spanish texts columns are visible. What I would like to do is set up a command button on a different form that will open the form with just the English showing in the combo boxes, and another button for Spanish. I've tried the following code which opens the form, but the combo box is disabled altogether.

DoCmd.OpenForm "frmEditar", acNormal, "", "", , acNormal
DoCmd.SetProperty "niv_gest", acPropertyColumnWidths, "0;1;1"

What am I missing?

View 5 Replies View Related

Modules & VBA :: Combobox / Listbox Change Event Populate Values In It

Nov 21, 2013

I am trying to write a code that will execute at the change even of the combobox/Listbox and when a character is typed in it then all the data from "DocumentType" field whose first character matches with the first character typed in Combo/Listbox will be stored in it.

The following code doesn't work:

Private Sub ComboBox4_Change()
Dim strText, strFind As String
strText = Me.ComboBox4.Text
If Len(Trim(strText)) > 0 Then
strFind = "BarcodeRef like '" & strText & "*'"
End If

[Code] .....

View 1 Replies View Related

Possible To Change Desktop Icon For ACCDB

Nov 15, 2011

I'd like to have a custom icon for the accdb file for the users. I recall doing it for pre-2007 databases, but I can't figure out how to change the 2007 db. Is it possible with 2007?

View 7 Replies View Related

On Change Event In Form

Sep 29, 2005

I have a field (AR#) that has an "on change" event. This is supposed to check through the database and see if that number has been here before (it's like a job # / serial #). It had always worked fine - now suddenly this field, and this field only, reacts VERY, VERY slowly when you type a number in. You can type the number and wait about 5 seconds for it to show up. When I removed the event - it acted normally so I think it has to do with that. Here's the vb for the event:

Private Sub AR__Change()
Dim db As Database
Dim Rst As DAO.Recordset
Dim strAR As String
Set db = CurrentDb()
strAR = Me.AR_.Text
Set Rst = db.OpenRecordset("repairs", dbOpenDynaset)
Rst.FindFirst "[AR#] = '" & strAR & "'"
If Rst.NoMatch Then
Else
MsgBox ("This value it is already in the system !")
End If
End Sub


Any ideas why it's reacting so slow or what I should look for?

View 2 Replies View Related

Forms :: OnLoad Runs When Closing Form

Oct 9, 2013

I have an A2007 application running on XP. From main form, Form1, another form, Form2, is opened.

When I attempt to close the application by clicking in the cross in the rh-corner of Access window, I get a crash midway through the OnLoad of Form2. I cannot figure out why the heck the On Load event fires when the form is being closed, and have some difficulties stepping through the code.

I recall having heard of OnLoad firing when trying to close a Form.

View 6 Replies View Related

Use Query Results OnLoad Of Form To Conduct An Action

Jan 2, 2008

Alright. I've tried searching, but to be honest, I'm not even sure what to search for.

I want to create some VBA that onLoad of the opening form of the database, it will take info from a query that looks for data entered for a student. It will be looking to see if there is data in two date fields. If it finds data in both fields, then I want to make a change to the EnrollmentID row of another table to changed the graduated column from No to Yes.

To expand on that, I'll want to check each ClassID row and if all of the associated students of that class have the column Graduated checked as yes, it will place the date in the date column for that particular class.

This is essentially my way of auto-archiving data as the combo box selections on my forms don't allow for class data to be shown if there is a Closed Date entered for the class and you won't be able to enter more test results for a student if the Graduated Column is checked in the Enrollment table (associates memberID, ClassID, CourseID into a single table)

Any insight on how to do this would be greatly apprecaited.

View 6 Replies View Related

Modules & VBA :: How To Add Icon / Image To List Box

Aug 15, 2013

is there any way to adding icon/image to the list box of ms access. what is the way?

View 1 Replies View Related

Modules & VBA :: Access Calendar Icon Appears All Over The Place?

Sep 14, 2013

I have migrated an A2003 application to A2013 and in one of the A2013 forms I get a calendar icon appear all ove the place.

I uploaded a short video at

[URL]

When the form opens (shows dentist appointments by chair) the icon appears that the very top in Chair 1. I can add a patient, no problem.

When I click on an appointment in Chair 2, the icon appears in the last clicked appointment on Chair 1. When I then click on Chair 1 the icon appears on the last clicked appointment on Chair 2.There is no problem with the A2003 version. I DO NOT use the Calendar icon in my application or any third party software.

View 2 Replies View Related

Modules & VBA :: Form Won't Go To New Record On Current Event

Jun 3, 2015

I have a form with a subform. In the form's On Current event I have the subform's visible property set to false. There is a button that when clicked sets the subform's visible property to true. I want the subform to go to the first control in a new record which is a combo box. the subform is a multiple items form. I have tried the GoToControl in the subforms OnCurrent event, but it is not working. I get an error saying the database cant find a third form.

View 4 Replies View Related

Modules & VBA :: Putting A Form BeforeUpdate Event

Jul 19, 2013

I have On Load, Current, After Update events on a form, which all work fine. But, when I add a Before Update, I get the error: "Procedure declaration does not match description of event or procedure having the same name". Following is my code:

Code:

Private Sub Form_Load()
If InStr(Me.Filter, "=") > 0 Then
If IsNumeric(Mid$(Me.Filter, InStr(Me.Filter, "=") + 1, Len(Me.Filter) - InStr(Me.Filter, "="))) Then
Me.Tag = (Mid$(Me.Filter, InStr(Me.Filter, "=") + 1, Len(Me.Filter) - InStr(Me.Filter, "=")))
End If
End If

[code]....

View 3 Replies View Related

Modules & VBA :: Form Event To Update Stock?

Nov 14, 2014

I have an order form with an order details sub form. Both are bound to their respective tables and function correctly, with the OrderID being inserted automatically into the order details table.

However I am using VBA to update and check stock and have it working when attached to a separate form called process orders. Which event would be the best place to place this code. I do not really want to have the process orders form. Would it be on the master form or the sub form. I thought of placing it in the after insert event on the subform, but there can be many order items per order and it will run before I have finished adding order items. I tried it in the after insert event on the master form, but I think that this will run the code too soon as at this stage the order details will not have been written to that table.

View 4 Replies View Related

Modules & VBA :: Form Current Event Error 438

Jul 28, 2015

I have error 438 Object doesn't support property or method in a Form On Current event.

Error trapping is turned on, reason being I converted the form to accde and it stopped working!

The code is...

Private Sub Form_Current()
On Error Resume Next
Dim ctl As Control
'Me.CC_Spare_3.Enabled = False
For Each ctl In Me.Controls

[Code] ....

The highlighted text when in debugger is

ctl.Locked = Me![Check411]

View 4 Replies View Related

Modules & VBA :: Calling On Current Event Of Another Form

Apr 20, 2015

I want to call the "On Current" event of another form.

I have a parent(mainform) form and then I have a subform(CurrentForm) and in that subform(CurrentForm) I have another subform(mysubtab01). From the mySubTab01, I want to call the On Current of the parent form. How can i do this?

This is an example of how I am setting the record source of the deepest subform where I want to call the parent on current from:

Forms(mainform)(CurrentForm)(mySubTab01).Form.Reco rdSource = "Select * from subQrytab03"

View 12 Replies View Related

Modules & VBA :: Place If Statement In AfterUpdate Event On Form

Nov 13, 2014

I'm trying to place an if statement in an afterupdate event on a form. The code I have is

Code:
If [Customer] Like "BRO001" And [Inv No] is null Then [Job_Price] = [Shots] * 27.5

this gives me a run time error, object required and highlights

Code:
If [Customer] Like "BRO001" And [Inv No] Is Null Then

I'd like the code to do nothing where the requirements to alter the job price are not met.

View 5 Replies View Related

Modules & VBA :: Call Text Box OnExit Event From Another Form

Jun 26, 2013

I was wondering if you can call a textboxes onExit event from another form? On my form a user enters a search criteria into a text box and when they exit the textbox the results are displayed in a listbox. This form is a subform on my main form. I want to be able to call this onExit method from the main form. Is that possible? When I put in txtSearchBox_Exit, I got an error saying Sub or Function not defined.

View 5 Replies View Related







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