Access Hangs On Form_Load Event

Feb 24, 2006

My Access app hangs when running the following code on Form_Load:

VB Code: Original - VB Code Private Sub Form_Load()On Error GoTo listbox_errorDim strSQL As String, strList As StringDim listrs As New ADODB.RecordsetSet listrs = New ADODB.RecordsetstrSQL = "SELECT * FROM sections"listrs.LockType = adLockPessimistic With listrs .ActiveConnection = open_conn() .Open (strSQL) End WithDo Until listrs.EOFstrList = strList & listrs("id").Value & ";" & listrs("section").Value & ";"LoopstrList = Left(strList, Len(strList) - 1)Me.cmbSection.RowSource = strListMe.cmbSection.RowSourceType = "Value List"listrs.CloseSet listrs = Nothinglistbox_error:MsgBox Err.DescriptionExit SubEnd Sub  Private Sub Form_Load()On Error GoTo listbox_errorDim strSQL As String, strList As StringDim listrs As New ADODB.RecordsetSet listrs = New ADODB.RecordsetstrSQL = "SELECT * FROM sections"listrs.LockType = adLockPessimistic         With listrs         .ActiveConnection = open_conn()         .Open (strSQL)         End WithDo Until listrs.EOFstrList = strList & listrs("id").Value & ";" & listrs("section").Value & ";"LoopstrList = Left(strList, Len(strList) - 1)Me.cmbSection.RowSource = strListMe.cmbSection.RowSourceType = "Value List"listrs.CloseSet listrs = Nothinglistbox_error:MsgBox Err.DescriptionExit SubEnd Sub

The connection is in a module named publicfunction:
VB Code: Original - VB Code Public Function open_conn() As ADODB.Connection 'Opens connections to database Dim sPath As String sPath = CurrentProject.Path & "endjftocbe.mdb" Set open_conn = New ADODB.Connection With open_conn .Provider = "Microsoft.Jet.OLEDB.4.0" .ConnectionString = "Data Source=" & sPath & "; Jet OLEDB:Database Password=*****" .Open End WithEnd Function  Public Function open_conn() As ADODB.Connection     'Opens connections to database     Dim sPath As String     sPath = CurrentProject.Path & "endjftocbe.mdb"     Set open_conn = New ADODB.Connection     With open_conn     .Provider = "Microsoft.Jet.OLEDB.4.0"     .ConnectionString = "Data Source=" & sPath & "; Jet OLEDB:Database Password=*****"     .Open     End WithEnd Function

Any ideas why it is hanging? The conn to the database is successful when I use it for the login procedure, but after that, I can't seem to get back in.

thanks

View Replies


ADVERTISEMENT

Ms Access Hangs Up During Rs.update??

Mar 4, 2007

hello..

I have this problem that when I update the value in one of my tables, MS Access hangs up. I don't know why. I dont know if it's because of the updating or because of something else.. Any help would be greatly appreciated.. Thanks in advance! ;)

here the code that's executed when the approve button is clicked..

Private Sub Command43_Click()

Answer = MsgBox("Are you sure you want to approve this timesheet? Note that only projects approved by respective project managers will be approved.", vbYesNo)
'if cancelled
If Answer = vbNo Then
Else
Dim rs As Object
Dim x As Integer 'will be used as a flag for do while loop

x = 1 'initialize flag
Set rs = Me.Recordset.Clone

rs.FindFirst "[weekending] = #" & Format(Me![weekending], "mm/dd/yyyy") & "#"

'finding the first record wich matches the weekending doesn't give the right record
'right away. it may give a record with the right weekending but different eno. that is
'not supposed to happen. so once a weekending match is found, check if the eno also
'matches. this do..while loop will do the trick =)
Do While x < 18
If rs!eno = Forms!TimesheetDetailsFrm!eno And rs!statusPM = "approved" Then
rs.Edit
rs!status = "approved"
rs.Update
x = x + 1
End If
rs.FindNext "[weekending] = #" & Format(Me![weekending], "mm/dd/yyyy") & "#"
Loop

'close this form and refresh the 'timesheets for approval' form
Answer = MsgBox("You have successfully approved the timesheet. Close this window to continue viewing other submitted timesheets.")
Forms!SupervisorFrm.Requery
End If

End Sub


Thanks again..

ps. How do I mark a post as 'resolved'? Coz I have a previous post which has already been solved.. Thanks to all of you guys. ;)

View 2 Replies View Related

Access Hangs While Scrolling Columns

May 29, 2015

Access 2007 has hung up while I scrolled from left to right through the columns in a linked ODBC table in datasheet view. I understand why it "hangs" while scrolling through rows, but I've never heard of it doing this for columns and I am talking about a complete freeze up here.

View 3 Replies View Related

General :: When Converting Front End To MDE Access Hangs

May 4, 2013

When converting the Front End of my database to an MDE, Access just hangs and says (Not Responding). I've left it our an hour and there's no sign of stirring.The Back End converts in just a second or so.

View 5 Replies View Related

New Problem, Small Change Hangs Access/TOAD

Dec 18, 2005

OK, sorted out that last problem I had.... Heres a new one.

This query runs fine:

SELECT [Piping Models by Area].AREA_NAME, [Piping Models by Area].MODEL_NO, [All Pipes].LINE_ID, [All Pipes].PIPING_MATER_CLASS, [All Pipes].PIPE_LENGTH

FROM [Piping Models by Area] LEFT JOIN [All Pipes] ON [Piping Models by Area].PARTITION_NO = [All Pipes].PARTITION_NO

WHERE [Piping Models by Area].AREA_NAME like "545*"

ORDER BY [Piping Models by Area].AREA_NAME, [Piping Models by Area].MODEL_NO, [All Pipes].LINE_ID, [All Pipes].PIPING_MATER_CLASS;

Add one WHERE criteria, and it no longer runs, under Access or TOAD for Oracle, or SQL*Plus, or anything:

SELECT [Piping Models by Area].AREA_NAME, [Piping Models by Area].MODEL_NO, [All Pipes].LINE_ID, [All Pipes].PIPING_MATER_CLASS, [All Pipes].PIPE_LENGTH

FROM [Piping Models by Area] LEFT JOIN [All Pipes] ON [Piping Models by Area].PARTITION_NO = [All Pipes].PARTITION_NO

WHERE [Piping Models by Area].AREA_NAME like "545*" and [All Pipes].PIPING_MATER_CLASS = "F13B"

ORDER BY [Piping Models by Area].AREA_NAME, [Piping Models by Area].MODEL_NO, [All Pipes].LINE_ID, [All Pipes].PIPING_MATER_CLASS;

It works fine, and is nice and fast, until I add the second "WHERE" criteria.

[Piping Models by Area] and [All Pipes] are both queries and run fine on their own. This query also runs fine without the WHERE clause.

Any ideas? Is there some small syntactical error causing some kind of infinite loop or something?

Edit: formatted for easier viewing

View 1 Replies View Related

Form_Load() : Error #0

Jul 20, 2006

Ok this is driving me batty I have the following Form_Load():

Private Sub Form_Load()
On Error GoTo LoadError
DoCmd.Maximize
LoadError:
MsgBox "Error : " & Err.Number & vbCrLf & Err.Description
End Sub

and I keep getting Error : 0

Yet I can't find anything refering to an error # 0.....

Can anyone give me some insight to this???

Richard

View 1 Replies View Related

Hangs & Exit

Aug 21, 2005

I'm having an application which is developed in access. It's running quite well, some times when I made changes to forms or reports it hangs for a while and exits without saving, it happens sometimes not always... what could be the problem? how can I rectify this..

View 3 Replies View Related

Query Hangs When Trying To Run?

Sep 12, 2014

I am facing a recent problem in my access 2002 and access 2010 on my computer. I am not able to run new queries even simple ones because when I try to execute it , it starts to hangs and access stop responding.

View 1 Replies View Related

Hyperlinked PDF Package Hangs Computer

Jan 14, 2008

I have hyperlinks from within Access forms that link to Adobe PDF documents; these are the new PDF Package documents created with Acrobat 8 - and give the message "Multiple files are bound together in this PDF Package."

The problem I am having is that when ever I click on the hyperlink the computer hangs (from the task manager, I believe that it is Acrobat Reader that is hanging). This problem only occurs with multi-file PDF packages and does not occur with regular PDF's. It also only occur with MS Access, as linking to theses files from MS Word encounters no problems.

Is anyone aware of a fix for this?

View 6 Replies View Related

Modules & VBA :: OutputTo Hangs On Error 52

Nov 10, 2014

Some of my users do not have access to all of our servers. In trying to automate I've hit one user whose system hangs up when Access tries to write to a server folder she does not have write (or even read) permissions for (Error 52, Bad file name or number). See the "Me.CitationType > 500" line below.

Code:
Private Sub comboStatus_AfterUpdate()
Dim hDate As String
Dim sFile As String

[Code]....

It gets as far as "If Len(Dir(hDate, vbDirectory)) = 0" and then hangs with Error 52. Testing for Dir() sooner doesn't work either.

how to either test for read-write permissions or trap Error 52. "On Error GoTo ErrorHandler" never fires to even test for 52, unless I'm missing something.

View 6 Replies View Related

Computer Hangs Accessing Network Database Files

Oct 6, 2004

And yes I now that's the title of a Knowledge base article, I stole it because it put into words what I can only say in expletives right now.

Basically, well it's all a bit odd.
I got users on the network who, until yesterday, could access some networked databases. Other files from the same source are ok, just Access files.
Today the moment they click (and I mean a single-click) on the icon to open the database...explorer hangs.
You can't open the database from within MS Access either, that hangs too. But you CAN open them up and use them if you can get them copied locally.
Oh yeah, some people (in the same room, on the same VLAN) can access the database, but can't perform any tasks within it.
Databases are a mix of 97 and 2000.
And to make matters worse, it's happening on another server.

I know you're gonna shout virus, but that looks to be a non-starter since I know of no such virus which would affect ONLY Access files and do it on a single click, and secondly The systems check out fine with both Sophos (and our good luck charm AVG) run against them.

Holy Moley! Has anyone ever come accross such a palarva?

View 2 Replies View Related

Um... Acess Hangs Temporarily When My Mouse Hovers Over 'Print' Icon

Mar 20, 2006

Hi there

Strange problem, i'm using XP Pro and Access from Office 2003 (both real full versions from work) - and in general use, when the mouse hovers over the 'print' icon (at the top left, undernear file, edit, view, insert, near 'save', 'new', etc), then access will hang for about 20 seconds then snap back into action.

Now, i don't even want to print anything! But every now and again i accidentally hover over it and it's bugging the hell out of me. Everything is updated (but i will check again now).

Anyone know how to make this stop? I tried a quick search but didn't get far.

Cheers!

Edd

View 3 Replies View Related

How To Trigger Access Table Update Event

Jan 5, 2005

Hi,

I use access database for a website. I would like to run a trigger in a specific table when updating a record.

Is it possible to create table level triggers in Access at all, if it is, pls. give me short direction. (as far as I know there are lot of events, but this events occur only in native access application only, and can not be handled outside of access, am I right?)

thanks a lot

solesz

View 1 Replies View Related

Modules & VBA :: Build Event - Access Crashing

Jul 9, 2014

I am trying to build an event when I double click a field. As soon as I click on Code Builder, access crashes. It does this with every access database I open.

View 14 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 :: Change Event - Cannot Access New Contents Of Textbox

Oct 2, 2013

I am developing a form whereby the user types a single character or a sequence of characters into textbox and a query WHERE clause is compiled upon each character being entered.

The query is the Row Source of a listbox which I requery upon each change in the text box contents.

In the Change event I cannot access the new contents of the textbox until focus moves to another control and then back to the textbox. This is not how I expect this event to work.

View 3 Replies View Related

Modules & VBA :: KeyDown Event For Report In Access 2003

Jun 5, 2014

I am aware that access 2007 has keyDown event for reports but access 2003 does not. My client's system is written in 2003 and he is not willing to invest in 2007.

Is there a way to have the report print by selecting F6 after the customer views the reports contents to see if they are correct.

View 1 Replies View Related

Modules & VBA :: Birthday Remainder On Access Form Load Event

Apr 26, 2015

I would like to have a birthday remainder on access form load event VBA...

I have tblEmp with 2 fields,

Name DOB
A 22/04/1977
B 25/03/1965
C 17/08/1985

I would like to compare Date and month with my system date to show in the message box "Mr. A Birthday Today" on the Form load event...

View 12 Replies View Related

Modules & VBA :: How To Access Description Inside Form Error Event

Jul 31, 2013

I'm trying to extract information from Err.Description within a form's Error event. Alas, Err.Description does not seem to be available from there.I have a form that normally displays in DataSheet view. If a trigger on the Oracle back-end raises an error, I want my Access app to be able to parse out Err.Description and deliver a more user-friendly message than ODBC's message. I want to get the info about the message from the error coming back from Oracle, not by matching up error codes.

If I change the form to Single-Form view and put a Save button on it, I can capture Err.Description in the command button's Clicked() event, and then parse out what I need.So if I must display this form in Datasheet view, where can I trap the ODBC error and display my user-friendly message?

View 5 Replies View Related

A New Event

Oct 28, 2007

Hi


I would like to make an event that occurs when the value in the textbox (unbound) is changed.
Can you please show me how to do it?


Thanks

View 1 Replies View Related

Which Event?

Apr 4, 2005

I have a form that has (among other things):

1) a delete button (to delete a record)
2) a Search Payee box (that lists all payee names)
3) an SSN text box

I have code in the "On Enter" event of the SSN text box that pops up a message box asking which way to format the SSN (regular or as tax id). This works fine when entering a new record.

I just discovered, however, that when I delete a record then this message box comes up as well and I don't want it to. Instead I want to use the code "srchPayee.SetFocus" after a record is deleted to move the cursor/focus to the Search Payee box so that the SSN message box does not invoke.

I've tried putting the "srchPayee.SetFocus" in events on the form and also on the delete button, but no matter what I do the SSN message box still pops up after the record is deleted. Which event can I put this code in so that after deleting the record the focus moves to the Search Payee box and the SSN message does not appear?

Thanks!
Laurie

View 9 Replies View Related

Which Event Should I Use?

May 20, 2005

Form1 has a sub form, Form2, which have a tab control with a number of tabs. One of them, Tab4, includes a sub form, Form3.

I have an SQL statement that I want to run (using DoCmd.RunSQL) when Form3 is shown on screen the first time, e.g. when Tab4 activates. I've tried OnClick for Tab4, OnActivate for both Form3 and Tab4 along with a dozen other events with no result. Maybe the problem is that the tab control is also in a subform?

Any suggestions?

View 2 Replies View Related

Which Event?

Jun 3, 2005

I have a combo box with 'yes' and 'no' as options. The default is 'no'. When a user changes it to 'yes', I need to make several text boxes visible on the form. Q. Would it be better to user the OnChange or AfterUpdate event and why?

View 2 Replies View Related

Help With Event Procedure

Apr 11, 2006

Can someone help? I am working on an event database (based on Microsoft 2003 event database template). At present when I register attendees, I can preview an invoice which is generated based on the information I have entered.

I have set up another option to preview a Letter of Confirmation based on this same principal. As I am "Visually Basic" challenged, I simply 'copied & pasted' the event procedure and made the changes as needed to ensure the correct report was opened (ie not the Invoice report but Confirmation Letter report).

However, when I click the button to open preview the letter, the "Print Invoice" box also opens up (as it does when previewing the invoice). I don't want this box to open as I don't need to enter any details.

Can someone please have a look at my VBA event below to see what I would need to delete to stop the "Print Invoice" box from popping up.

Private Sub LOC_Click()
On Error GoTo Err_ConfirmationLetter_Click
If Me![Attendees Subform].Form.RecordsetClone.RecordCount = 0 Then
MsgBox "Enter attendee and registration information before previewing the Confirmation Letter."
Else
DoCmd.OpenReport "ConfirmationLetter", acPreview, , "[RegistrationID]=" & Forms![Attendees]![Attendees Subform].Form![RegistrationID]
End If

Exit_ConfirmationLetter_Click:
Exit Sub

Err_ConfirmationLetter_Click:
If Err <> 2501 Then
MsgBox Err.Description
End If
Resume Exit_ConfirmationLetter_Click
End Sub


Many thanks for any help.
Kath Price
Auckland, New Zealand

PS - Below is the original 'Preview Invoice' event that I copied:
Private Sub PreviewInvoice_Click()
On Error GoTo Err_PreviewInvoice_Click
If Me![Attendees Subform].Form.RecordsetClone.RecordCount = 0 Then
MsgBox "Enter attendee and registration information before previewing the invoice."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenReport "Invoice", acPreview, , "[RegistrationID]=" & Forms![Attendees]![Attendees Subform].Form![RegistrationID]
End If

Exit_PreviewInvoice_Click:
Exit Sub

Err_PreviewInvoice_Click:
If Err <> 2501 Then
MsgBox Err.Description
End If
Resume Exit_PreviewInvoice_Click
End Sub

View 2 Replies View Related

Need Help To Detect Event

Aug 19, 2005

Hello,
In an empty field how to detect that the RETURN key has been pressed, i don't know hot to differentiate the RETURN KEY and the field exit by clicking the mouse in an other field because in the 2 cases the value of field is set to "", is there a way to test VbKey in a field ?

This because i want to set my field to a default value only when i press RETURN and i don't want the LostFocus or Exit set my field to this default value if nothing has been typed in my field.
(I must precise that for some reasons in my form the KeyPreview is set to TRUE.)

Thanks in advance for help.
VINCENT.

View 2 Replies View Related

Where To Put My Event Procedure

Oct 18, 2005

In my database I track a program called Bridge. Once you open bridge you can have anywhere from 1 to 7 "Sessions". Each bridge is assigned a number IE LT175A. If there are mulitple sessions they are numbered LT175A, LT175B, LT175C etc. I have a check box in my database that shows if bridge is installed on that PC. If it is then my section for session numbers are visiable, if bridge is not checked then the session numbers section isn't visiable. I currently have my Event Procedure in the After Update section. My code works because if I unclick on bridge my sessions disappears. However when I go to the next record if bridge is checked then my sessions are visiable but on the next record where it isn't checked it still displays the session section. So it isn't adjusting itself from record to record. Does my code need to go someplace else or am I doing something else wrong?
Here is the code I have:(and it's under After Update)

Private Sub Bridge_AfterUpdate()

If Me.Bridge = False Then
Me.BridgeSession_1.Visible = False
Me.BridgeSession_2.Visible = False
Me.BridgeSession_3.Visible = False
Me.BridgeSession_4.Visible = False
Me.BridgeSession_5.Visible = False
Me.BridgeSession_6.Visible = False
Me.BridgeSession_7.Visible = False

ElseIf Me.Bridge = True Then
Me.BridgeSession_1.Visible = True
Me.BridgeSession_2.Visible = True
Me.BridgeSession_3.Visible = True
'Me.BridgeSession_4.Visible = True
'Me.BridgeSession_5.Visible = True
'Me.BridgeSession_6.Visible = True
'Me.BridgeSession_7.Visible = True
End If
End Sub

Thanks,

Rick

View 2 Replies View Related







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