Update After Lost Focus

I have a form with a combo box for the user to select a specific date. I need to update the date field after the combo box loses focus instead of on the change of a record.

Can someone provide me the vb code that will update the field when the focus is lost?

Thanks for your help,

Jeff



ADVERTISEMENT

Got/lost Focus Help Please

Hi there.

I have a form and on open it traps the user into a combo box where an option must be selected before they can move to another field. I did this by using the lost focus event of the combo to check if an option has been selected and then return the cursor to the combo if no selection has been made.

The problem is that there is an exit button on the form which the user must be able to use to exit the form without interacting with it, say if they opened the form by mistake and just wanted to exit immediately.

I cant find a way to trap users into selecting an option from the combo before filling the rest of the form while still allowing the exit button to work. At the minute you still have to select an option in the combo even if you just want to exit the form.

I have been a notes developer for years so Iím still not that familiar with access and the way its events work so this could easily be a gormless question. Feel free to point that out. Any comments would be much appreciated.

View Replies View Related

On Lost Focus....check To See If Primary Key Exists

Hi there

I recently have been given a database to get into shape.

One of the main problems is that when a person enters data into a form, They until the leave the form are not aware if the primary key has been used before.


Let me try explain.

I have a booking number (which I have only in the last couple of days made a primary key and also changed it so there can be no duplicates)

I have changed the form around alittle so that the person entering the new data must start with entering the booking number.

How can I make a piece of code that once the booking number textbox loses its focus the code then checks the table to see if that booking number exists. I would like for the person to establish that they need to enter a new booking number before getting to the end before seeing that the booking number already exists.

I hope I am making some sense.


TIA

View Replies View Related

Hide Command Button On Lost Focus

Seems simple, but I haven't been able to crack this one.

I've searched and haven't found an obvious answer.

I want to hide a command button after it loses focus. I've tried placing this code on the On Lost Focus and On Exit events of the command button.

Me.cmdName.Visible = False

I get the 2165 error, 'Can't hide a control that has a focus'.

I guess one solution would be to force the focus to another control first, however, "how do I know what control the user is attempting to move the focus to?"

View Replies View Related

Lost Focus Validation No Running - Version: 2003 (11.0)

I have form and on this form I have a txtbox called InvoiceNumber. When or if a user tabs out or click out of this box and there is not data I would like a msg to appear and reset the focus back.

The code I have seems to not even be seen by access. Can someone verify this and tell me what is off?

Code:Private Sub InvoiceNumber_LostFocus()
Dim intMsg As Integer

If Me.InvoiceNumber = Null Then
intMsg = MsgBox("You have to enter an Invoice Number", vbOKOnly +
vbInformation + vbApplicationModal, "Invoice and Auditing")
Me.InvoiceNumber.SetFocus
Else
Me.LinehaulCost.SetFocus
End If

End Sub

Thanks in advance

View Replies View Related

Hold Decimal On Lost Focus - Version: 2003 (11.0)

I have three fields on a form and button.

FieldA holds a constant haul rate amount of $5/hr.
FieldB holds a data entry of hours.
FieldC holds the product of the hours and the haul rate to give the total dollars.

The button adds the record. The add record does not hold the product of the calculation but I would like to give a real time preview of what the query will produce.

What I have set up now is that on the on change event of FieldB, the commandbutton gets focus, then focus is returned to FieldB at the end of the entry.

The result of this means that if someone enters a 1 $5 appears in field C, then hits a 0, $50 appears in fieldC.

This all works fine to give real time changes to FieldC, however when you hit a decimal, when fieldB loses focus it truncates the decimal. Is there anyway on the lost focus to have it keep the decimal?

Thanks,

View Replies View Related

Problem With Simple Lost Focus - Version: 2003 (11.0)

I am trying to calculate a fuel surcharge percentage from some invoicing. Math is pretty simple, see below.

Code:Private Sub FuelSurcharge_LostFocus()
Dim intFuel As Integer
Me.Total_Invoiced.Value = Me.LinehaulCost.Value + Me.CarrierCost.Value +
Me.FuelSurcharge.Value + Me.Accessorial_Charges.Value
intFuel = (Me.FuelSurcharge.Value Me.CarrierCost.Value)
Me.Actual_Fuel.Value = intFuel
Me.Difference.Value = Me.Total_Invoiced.Value - Me.EstimatedCost.Value
End Sub

The thing is after the field loses focus and I follow it through I see that the FuelSurcharge.value is 62.7 and the CarrierCost.Value is 285. So the data is there. But it shows the value for intFuel as 0.

I have tried it as a double, integer I can't figure out why it is always 0 when it should be .22

Can someone help?

View Replies View Related

Controlling External Database When Focus Lost - Version: 2003 (11.0)

Hey all, I was wondering how to control "puppet" database from a "source" database . I have code from the source which opens the puppet, but after it is open, the puppet just stays open and the source does not execute further code until i manually close it.



Code:

With db

.Visible = False

.OpenCurrentDatabase (cFileInfo.Path & cFileInfo.FileName)

.CompactRepair cFileInfo.Path & cFileInfo.FileName, cFileInfo.Path & "~" & cFileInfo.FileName, True

sSleep 2000

.Application.Quit

End With



The red code will not execute until i give the focus back to source database. Also , there are some autoexecs within the puppet. If possible, is there a way for it to wait for the autoexec to finish without adding a quit command into the puppet autoexec macro. This is because i do not have access to these databases directly. (there are about 10 databases my source has to control, let autoexec, close)



Thanks!

View Replies View Related

New Recordset's Memo Field Data Lost On Update

morning

i am adding a new row to an adodb.recordset, one of the fields being a Memo datatype.

all the other fields will write to the database fine, but with the memo, it will mysteriously disappear when i call rs.update

response.write(rs("my_memo_field")) 'give correct output
rs.update
response.write(rs("my_memo_field")) 'gives nothing!

any one else had this happen and have a solution?


cheers

View Replies View Related

Determine Control Getting Focus Before 'before Update' Event - Version: 2003 (11.0)

I have a tabbed form that upon changing tabs uses the before update event to check if required info was entered on that tab or if it wasnt saved. That works fine. I now have to add subforms to one of the tabs which is where I'm having a problem. when I enter info on that form then go to the subform, it triggers the before update mentioned above which I dont want to happen at this point.

Is there a way I cant test to see if the focus is going to the subform BEFORE or During the 'Before Update' event? That way I can avoid the 'before update' event or at least exit out of it before the existing code runs.

View Replies View Related

After Update On A Subform - Set Focus On Main Form - Version: 2003 (11.0)

I have a mainform called JobsForm and a subform on the JobsForm called DetailsSubForm. After a field called Qty on the subform has been updated by hitting tab or space bar, I want the focus to go back to the mainform called Jobsform and goto the next record.

I thank you in advance for your help

View Replies View Related

Setting Focus To A Tab Based On The Focus On A Previous Form - Version: 2003 (11.0)

I have two forms one has header information and is a 7 tab control. Each tab represents a day of the week.

When I select a tab, lets say wednesday, I want to open the detail form and set the focus on the detail tab that represents wednesday.

I tried using the setfocus option but I am not sure how to code it, especially since my form name has blanks in it.

any help is appreciated.

View Replies View Related

Set Focus Nothing?

I have several forms and subforms that display data, but are not used for data entry. The first textbox on every form gets the focus on open. I'm sure I've seen some way to open the form with no focus on any control!

Can someone help me remember?

Thanks,

Sup

View Replies View Related

Get Focus

thanks for helping.

how do i get a record to get focus when a form opens or a button is clicked on?

thanks again

View Replies View Related

Set Focus

I am having trouble getting the cursor to change focus after updating a field in my tab control subforms. I have a main form with a tab control and 4 related subforms for each record in the main form.

I have a calendar that pops up with the On Click of my Date field. When the date is selected, it enters it into the field and the calendar closes. For some reason though the user cannot simply go to the next record with the mouse and has to tab to or select another field in the same record first and then click on the Date field in the next record.

I have tried SetFocus to "Hours" (the next field after "Date")and "NextRecord" on every Event I can think of but it does nothing, it just stays on the changed field and the only way to get out of it is to go to another field. I've tried saving, requery, etc. I've also tried the options shown in the forum with no luck and using different events associated with the Calendar form - On Close, Lost Focus, etc.

Any suggestions? Thanks

View Replies View Related

Which Tab Has Focus

I have a form that has 9 tab pages. I have an amend button in the form footer that will do a different thing depending on which tab has the focus. How can I find out which tab has got the focus when I click the Amend button?

View Replies View Related

Could Not Set Focus

Hi

I have a problem with setting focus to a text box. There is a listview on the form. Double clicking on a row will search the database for that record using SNo field and then display the contents on the respective control. When I click on a row the first time, it works. Clicking on the second row immediately gives the error "error 2110 - Access cannot set focus to the control txtReference.
Here is the code.......
Private Sub lvwOrders_DblClick()
ClearAll
Set rs = New ADODB.Recordset



rs.Open "SELECT * FROM tblOrderEntry where sno=" & ListView.SelectedItem, con, adOpenKeyset, adLockPessimistic
lblFooter.Caption = "Edit Record"

subRetrieve

End Sub



Private Sub subRetrieve()
Form_OrderEntry.SetFocus
With rs
For i = 0 To lstCostCenter.ListCount - 1
If lstCostCenter.ItemData(i) = !CostCenter Then
lstCostCenter.Selected(i) = True
Exit For
End If
Next i

txtReference.SetFocus
txtReference.Text = !ReferenceNo

txtOrderNumber.SetFocus
txtOrderNumber.Text = !OrderNo

For i = 0 To lstCostCenter.ListCount - 1
If lstCostCenter.ItemData(i) = !CostCenter Then
lstCostCenter.Selected(i) = True
Exit For
End If
Next i

For i = 0 To lstDescription.ListCount - 1
If lstDescription.ItemData(i) = !Description Then
lstDescription.Selected(i) = True
Exit For
End If
Next i

For i = 0 To lstOrderStatus.ListCount - 1
If lstOrderStatus.ItemData(i) = !OrderStatus Then
lstOrderStatus.Selected(i) = True
Exit For
End If
Next i


For i = 0 To lstSalesRep.ListCount - 1
If lstSalesRep.ItemData(i) = !SalesRep Then
lstSalesRep.Selected(i) = True
Exit For
End If
Next i

For i = 0 To lstPaymentMethod.ListCount - 1
If lstPaymentMethod.ItemData(i) = !PaymentMethod Then
lstPaymentMethod.Selected(i) = True
Exit For
End If
Next i

For i = 0 To lstCallType.ListCount - 1
If lstCallType.ItemData(i) = !TypeofCall Then
lstCallType.Selected(i) = True
Exit For
End If
Next i

For i = 0 To lstStatus.ListCount - 1
If lstStatus.ItemData(i) = !Status Then
lstStatus.Selected(i) = True
Exit For
End If
Next i

If !Status = "Pending" Then
txtReasons.Visible = True
lstAssign_Reasons.Visible = False
txtReasons.SetFocus
txtReasons.Text = !Reason
ElseIf !Status = "Assign" Then
lstAssign_Reasons.Visible = True
cmdSave.SetFocus
txtReasons.Visible = False
For i = 0 To lstAssign_Reasons.ListCount - 1
If lstAssign_Reasons.ItemData(i) = !Reason Then
lstAssign_Reasons.Selected(i) = True
Exit For
End If
Next i
End If


End With
End Sub

What can be going wrong ?

View Replies View Related

Lost A Dll?

i have just had a problem

if i try to edit an open form by clicking the design icon, i get a message

cant find the call back function or macro "fdesign". ican still close the form and open it from the dbs window

this is affecting accessXP and access20003, but not A97

ive tried repairing/reinstalling the XP installation (but not the 2003 yet), but this has not fixed it.

Any thoughts?

View Replies View Related

I'm Lost

I have a table and it has:

namefield
surnamefield
state1
state2
state3
match(Y or No)
importDate


I would like to make a query+ report so that in the report it looks like this:

<<Name>> <<Surname>>
<<state1>> <match>
<<state2>> <match>
<<state3>> <match>

in one line, at the moment I made a query and the name shows 3 times...

can anyone here give me some hints how to show the name once + the match. Thanks in advance

Cheers...

View Replies View Related

Lost And Need HELP!

I am new to using MS Access and am already frustrated that a simple task is getting the better of me.

My situation is that I work for a company that has a number of reps, which are allocated their own ticket books(block). Each book is 50 tickets in size i.e say from number 320500 to 320549. All tickets are entered through our internal system for whatever the ticket was used for.

Now here is my problem. Each block is registered to an individual rep which we need to keep record of as to which tickets are allocated to them, other then having to enter each ticket individually into our ticket block records system, I am trying to make a database entry that accepts the reps name, ticket block start number and then automatically adds the next 50 tickets to that rep, so when we use a search field on any ticket it displays the rep that the ticket was allocated too.

In my head i'm looking for the MS Access way of doing the following:
[tickblockstart]+1 until [ticketblockstart] = [ticketblockstart]+50

Can anyone help me with this probably very easy problem, that i can not seem to grasp at the present time.

Regards

2rsGarry

View Replies View Related

Im Lost!

hiya, im trying to create a button my form that will move all 'finished' records from where they presently are, to another table.
the button does work, it moves the records into the 'new' table, however it does not DELETE them from the table i moved them from, so now the records are stored in two tables??

the code i have is as follows:
SELECT * INTO Table2
FROM Table1
WHERE Finished='Yes';

if there is something different that i should be doing, or a better way to do this move, please let me know.

(also if this is in the wrong section feel free to move it)

thanks!

View Replies View Related

I've Lost Myself

:confused: Fingers crossed I'll get some direction to resolve an issue that I can't even begin to imagine how to search for.My database is used to record detailed work done with clients who are receiving regular support. I'm designing it around a Common Assessment Support Framework that I have no choice but to follow, except for some minor points. There is the potential for approximately 40 different assessments for each client and therefore a lot of duplication in personal details.So far this forum has been a great help and I have learned a lot from those who volunteer their time to those of us who need it from time to time.Following the numerous examples of normalisation posts I have attempted to ensure there is no duplication of information across tables. I've come to a point however where I am stuck:The end result of what I am trying to do is create an individual report called Needs Assessment Planning Tool - rptNAPT.The report will be populated from the fields in qryNAPT that is made up from tblIA1 and tblIA2tblIA1 consists of 17 x 'area of need' that is broken down in to 5 elements: 'Now - Y/N', 'Later - Y/N', 'User Level - Number', 'Worker Level - Number' and 'Disagreement - Memo'. These fields are entered by using frmIA1, and these fields are entered by using frmIA2.So, now I have to enter data in to another form; frmNAPT that includes both theseand thesefields. I only need to show the area of need where Now is True in the form and the subsequent report; rptNAPT.My thoughts about this are (please don't laugh) in the form frmNAPT the 'Area of Need' because in the table there are 17 different areas e.g. Accommodation (improvement), Homelessness, DomesticViolence etc will need to be unbound and in some way filtered to show only those area of need where fldNow is True? and fldUserLevel is NotNull or doesn't equal zero. I will need a minimum of five such fields to show the Areas of Need that the Client and Worker may elect to work on.Sorry for the long post but I'd really appreciate some direction on this, even if it is only to point me in the direction of a link that can be helpful.RegardsDoug

View Replies View Related

Setting Focus On Tab

Hi everyone,

how would i go about setting focus on a tab control? i have a tab control on a form with 6 tab pages. i am on page 4 ( bank ) and i have a button to add a bank account. this opens up the add form and i add the account. i then requery the form and the tab goes back to page 1. how do i set the focus back to the previous opened tab?

many thanks,


Nigel

View Replies View Related

Set Focus On Form

I have a form, and when it opens it has focus on a box i dont want it to focus on

How do i change which box it has focus on when it is opened?

View Replies View Related

Focus Problem

I have two buttons on a form, one of them adds default information to three boxes, the other clears the info. I want to be able to hide one o the buttons depending on what is in the box.

I know I need to change the focus away from the control in order to hide it, but how do I do it please?

I have this so far, but there is something missing!

Private Sub Command744_Click()
Me.BdeRec40kMarksmanship = Null
Me.BdeRec40kFireStatus = Null
Me.BdeRec40kOpening_Range = Null
Me.Command743.Visible = True
Me.command777.Visible = False

End Sub

View Replies View Related

Losing Focus

Hello All,

I am very new to Access and have a problem with focus in my secondary form (sorry probably wrong terminology).

I have a main company form with a button which links to a contacts form created through a query.

I cannot get the second form to focus from the first form i.e. Company A when i try to add or look at contacts assigned to Company A in the second form the (Autonumber) appears in the field, not the autonumber given to it from the company table.

Hope this is clear! I dont know any programming but feel fairly confident with the expression builder and properties box.

If anyone can help I would be very happy.

View Replies View Related

Subforms Focus

i have a main form, in which i have included 2 subforms on it. Now when i am at the last control on the main form, the focus moves to the first control of one of the subforms. However, when i am at the last control of this subform, on hitting the tab key, the focus does not move to the first control of the other subform.

How can i achieve this please?

Thank you!

View Replies View Related

Focus Problem, I Think...

I have a form that allows a user to select from a variety of options and then generate a report. It consists of three option groups:

1) Select a Team: A B C

2) Select a Report: A B C

3) Input a Date Range: From (blank) to (blank)

If you progress down the list and finish entering the enddate and then click the mouse on the Run Report button, nothing happens. The cursor remains blinking in the enddate field. You have to manually re-select one of your previous options on the form to get rid of the flashing cursor and then re-click the Run Report button to generate the report.

The option to include the Run Report button in the tab order is not available, I don't know why, but it is an image if that makes a difference.

Any ideas? I'm thinking I have to set focus for something. I just don't know when or where.

Thanks for all replies!

View Replies View Related

How Do I Set The Focus To The Next Record And.....

How do I delete this dummy record?

http://img.photobucket.com/albums/v401/Rrotz/phonelog1.gif

Also, how do I set the form to maximize fully like the above, when I open the form it defaults to this:

http://img.photobucket.com/albums/v401/Rrotz/phonelog.gif

View Replies View Related

Get Focus On A Control

Hi

I would like a control to have focus when a form is opened or press a button - how do i do this?

Many Thanks

View Replies View Related

Focus On A Form

How do i choose the field i want my focus to be on when a form i opened?

View Replies View Related

Object Focus

I'm trying to force a user to enter text into a field. To this end, I've created a subroutine for the exit method of the text box they are supposed to fill out. I check to see if the .text property is null, and if so create a message box that pops up a notification telling the user they need to fill in said field. After that, I try to use the Me.txtReason.SetFocus (the text box is called txtReason) to return the focus to that text box, but instead it moves on to the next text box. Is there a way I can prevent the user from leaving the text box until they've entered some sort of data into it?

Thanks,
Dave

View Replies View Related

Outa Focus~~~~

Little problem with a form and subform. Problem is...I don't know why I'm having this problem! :)
Have a form with a subform. Everything is working correctly,with one exception. The form is entering payments (checks) then the subform handles the distribution. So after you input one or more lines on the subform you click the "new record" icon. Problem is the focus stays in the subform and not to the top of the main form. I know I could code it to force it to set focus to the first field on the main form... BUT.. I've done this before and coding was not needed. So what did I do wrong on this one?
Thanks

View Replies View Related







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