Form Opening

  • Thread starter disneygoof via AccessMonster.com
  • Start date
D

disneygoof via AccessMonster.com

I love this site....if I haven't mentioned that before...

I have another STRANGE issues. I have a form 'A' and subform 'B' (continuous
layout). I have buttons on the subform that open another form 'C' and set
the seconf form to the PROJECTID of the subform...works fine.

I added a button to the first form 'A' to filter on a specifc column:
Private Sub AllProjects_Click()

If Me.FilterOn = True Then
Me.Filter = ""
Me.FilterOn = False
Me.AllProjects.Caption = "Show My Projects"
Me.AllProjects.ForeColor = vbBlue
Me.Refresh
Else
Me.Filter = "[LoginUsername] = '" & GetUserName() & "'"
Me.FilterOn = True
Me.AllProjects.Caption = "Show All Projects"
Me.AllProjects.ForeColor = vbBlack
Me.Refresh
End If

End Sub

Problem:
Up until about 2 months ago this wa working OK, NOW when a user clicks the
filter button and then tries to open form C, nothing happens. Calculating...
appears in the lower left, but nothing happens...

Strange part:
If I have them minimize the Application (YES the Application), then maximize
it, the form show's up. If they close the form C and reopen the form C it's
fine...UNTIL they click the filter button again.

The stranger thing:
This does not happen on MY laptop...

HELP!
David
 
S

strive4peace

Hi David,

please post the code you are using to open form C -- and for any button
on the form that is not working right

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 
D

disneygoof via AccessMonster.com

Code that runs when I cheick the button and open Form C

Basically I am check to see if the person is ALREADY tracking on a differnet
project or on what we call an XWO or The are starting fresh...

Private Sub Form_Load()

Dim gblTrack As Integer
Dim xwoTrack As Integer

'Me.Filter = "[username] = '" & GetUserName & "'"
'Me.FilterOn = True

'Check for tracking on project as a WHOLE -- LOOK inside Time Tracker
Table
gblTrack = Nz(DLookup("[TrackID]", "tblDetailingTimeTracker", "[Username]
= '" & GetUserName() & "'" & "and not isnull([StartTime])"), 0)

'Check for tracking time on XWO -- LOOK inside Time Tracker Table
xwoTrack = Nz(DLookup("[TrackID]", "tblDetailingTimeTracker", "[Username]
= '" & GetUserName() & "'" & "and isnull([StartTime])"), 0)

If xwoTrack <> 0 Then
DoCmd.OpenForm "frmDetailingTimeTracker", , , "[TrackID] =" &
xwoTrack
Me.lblProcess.Caption = "Tracking Time"
Me.Frame25.Locked = True
Me.btnStartTrack.Enabled = False
Me.frmDetailingTimeTrackerSubform.SetFocus
ElseIf gblTrack <> 0 Then
DoCmd.OpenForm "frmDetailingTimeTracker", , , "[TrackID] =" &
gblTrack
Me.lblProcess.Caption = "Tracking Time"
Me.btnStopTrack.Visible = True
Me.btnStartTrack.Visible = False
Me.Frame25.Locked = True
Me.frmDetailingTimeTrackerSubform.Enabled = False
Else
DoCmd.GoToRecord , , acNewRec
Me.lblProcess.Caption = "Awaiting START Sequence"
Me.ProjectID = Forms!frmBulletinAllProjects.ProjectID
Me.Refresh
Me.Username = GetUserName()
Me.EmployeeID = DLookup("[EmployeeID]", "tblEmployee", "
[LoginUsername]= '" & GetUserName() & "'")
Me.btnStopTrack.Visible = False
Me.btnStartTrack.Visible = True
End If

If GetUserName() = "davidw" Then
Me.btnClockedIn.Visible = True
End If

End Sub


Hi David,

please post the code you are using to open form C -- and for any button
on the form that is not working right

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
I love this site....if I haven't mentioned that before...
[quoted text clipped - 36 lines]
HELP!
David
 
D

disneygoof via AccessMonster.com

This is the Code behind the BUTTON that opend form C

Private Sub btnTimeTrack_Click()
On Error GoTo Err_btnTimeTrack_Click

Dim stDocName As String
Dim stLinkCriteria As String
Dim tracking As Integer
Dim trackProject As String

'Delete any DONE tracking that did not properly delete from Time Track
Temp Table
DoCmd.RunSQL "DELETE FROM tblDetailingTimeTracker WHERE (UserName = '" &
GetUserName() & "' and STST = 'DONE');"

tracking = Nz(DLookup("[ProjectID]", "tblDetailingTimeTracker", "
[Username] ='" & GetUserName() & "' and IsNull([STST])"), 0)
trackProject = Nz(DLookup("[ProjectAlpha] & '-' & [ProjectNo]",
"tblProjectInfo", "[ProjectID] =" & tracking), 0)

If tracking = Me.ProjectID Or tracking = 0 Then
stDocName = "frmDetailingTimeTracker"
DoCmd.OpenForm stDocName
Else
MsgBox "You are currently tracking time against Project " &
trackProject & cHr(13) & "You MUST stop tracking time before you can TRACK
time to another project!" & cHr(13) & cHr(13) & "HAVE A NICE DAY!!!!",
vbExclamation, "Project Time Tracking still in progress..."
End If

Exit_btnTimeTrack_Click:
Exit Sub

Err_btnTimeTrack_Click:
MsgBox err.Description
Resume Exit_btnTimeTrack_Click

End Sub
Hi David,

please post the code you are using to open form C -- and for any button
on the form that is not working right

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
I love this site....if I haven't mentioned that before...
[quoted text clipped - 36 lines]
HELP!
David
 
D

disneygoof via AccessMonster.com

Sorry, I said DIFFERENT below...should be just tracking on a project, XWO or
new project to track
David.
Code that runs when I cheick the button and open Form C

Basically I am check to see if the person is ALREADY tracking on a differnet
project or on what we call an XWO or The are starting fresh...

Private Sub Form_Load()

Dim gblTrack As Integer
Dim xwoTrack As Integer

'Me.Filter = "[username] = '" & GetUserName & "'"
'Me.FilterOn = True

'Check for tracking on project as a WHOLE -- LOOK inside Time Tracker
Table
gblTrack = Nz(DLookup("[TrackID]", "tblDetailingTimeTracker", "[Username]
= '" & GetUserName() & "'" & "and not isnull([StartTime])"), 0)

'Check for tracking time on XWO -- LOOK inside Time Tracker Table
xwoTrack = Nz(DLookup("[TrackID]", "tblDetailingTimeTracker", "[Username]
= '" & GetUserName() & "'" & "and isnull([StartTime])"), 0)

If xwoTrack <> 0 Then
DoCmd.OpenForm "frmDetailingTimeTracker", , , "[TrackID] =" &
xwoTrack
Me.lblProcess.Caption = "Tracking Time"
Me.Frame25.Locked = True
Me.btnStartTrack.Enabled = False
Me.frmDetailingTimeTrackerSubform.SetFocus
ElseIf gblTrack <> 0 Then
DoCmd.OpenForm "frmDetailingTimeTracker", , , "[TrackID] =" &
gblTrack
Me.lblProcess.Caption = "Tracking Time"
Me.btnStopTrack.Visible = True
Me.btnStartTrack.Visible = False
Me.Frame25.Locked = True
Me.frmDetailingTimeTrackerSubform.Enabled = False
Else
DoCmd.GoToRecord , , acNewRec
Me.lblProcess.Caption = "Awaiting START Sequence"
Me.ProjectID = Forms!frmBulletinAllProjects.ProjectID
Me.Refresh
Me.Username = GetUserName()
Me.EmployeeID = DLookup("[EmployeeID]", "tblEmployee", "
[LoginUsername]= '" & GetUserName() & "'")
Me.btnStopTrack.Visible = False
Me.btnStartTrack.Visible = True
End If

If GetUserName() = "davidw" Then
Me.btnClockedIn.Visible = True
End If

End Sub
Hi David,
[quoted text clipped - 19 lines]
 
D

disneygoof via AccessMonster.com

This checks to see if they are on a DIFFERENT Project.
This is the Code behind the BUTTON that opend form C

Private Sub btnTimeTrack_Click()
On Error GoTo Err_btnTimeTrack_Click

Dim stDocName As String
Dim stLinkCriteria As String
Dim tracking As Integer
Dim trackProject As String

'Delete any DONE tracking that did not properly delete from Time Track
Temp Table
DoCmd.RunSQL "DELETE FROM tblDetailingTimeTracker WHERE (UserName = '" &
GetUserName() & "' and STST = 'DONE');"

tracking = Nz(DLookup("[ProjectID]", "tblDetailingTimeTracker", "
[Username] ='" & GetUserName() & "' and IsNull([STST])"), 0)
trackProject = Nz(DLookup("[ProjectAlpha] & '-' & [ProjectNo]",
"tblProjectInfo", "[ProjectID] =" & tracking), 0)

If tracking = Me.ProjectID Or tracking = 0 Then
stDocName = "frmDetailingTimeTracker"
DoCmd.OpenForm stDocName
Else
MsgBox "You are currently tracking time against Project " &
trackProject & cHr(13) & "You MUST stop tracking time before you can TRACK
time to another project!" & cHr(13) & cHr(13) & "HAVE A NICE DAY!!!!",
vbExclamation, "Project Time Tracking still in progress..."
End If

Exit_btnTimeTrack_Click:
Exit Sub

Err_btnTimeTrack_Click:
MsgBox err.Description
Resume Exit_btnTimeTrack_Click

End Sub
Hi David,
[quoted text clipped - 19 lines]
 
S

strive4peace

hi David,

I need to see your database -- without seeing your structure, it is hard
to say what the problem is -- and the problem may be your form, not the
code to open it. Would you email it to me? Make the subject the same
as this thread subject. I will post questions and comments here, not
privately.

strivepeace2006 at yahoo dot com

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*



This checks to see if they are on a DIFFERENT Project.
This is the Code behind the BUTTON that opend form C

Private Sub btnTimeTrack_Click()
On Error GoTo Err_btnTimeTrack_Click

Dim stDocName As String
Dim stLinkCriteria As String
Dim tracking As Integer
Dim trackProject As String

'Delete any DONE tracking that did not properly delete from Time Track
Temp Table
DoCmd.RunSQL "DELETE FROM tblDetailingTimeTracker WHERE (UserName = '" &
GetUserName() & "' and STST = 'DONE');"

tracking = Nz(DLookup("[ProjectID]", "tblDetailingTimeTracker", "
[Username] ='" & GetUserName() & "' and IsNull([STST])"), 0)
trackProject = Nz(DLookup("[ProjectAlpha] & '-' & [ProjectNo]",
"tblProjectInfo", "[ProjectID] =" & tracking), 0)

If tracking = Me.ProjectID Or tracking = 0 Then
stDocName = "frmDetailingTimeTracker"
DoCmd.OpenForm stDocName
Else
MsgBox "You are currently tracking time against Project " &
trackProject & cHr(13) & "You MUST stop tracking time before you can TRACK
time to another project!" & cHr(13) & cHr(13) & "HAVE A NICE DAY!!!!",
vbExclamation, "Project Time Tracking still in progress..."
End If

Exit_btnTimeTrack_Click:
Exit Sub

Err_btnTimeTrack_Click:
MsgBox err.Description
Resume Exit_btnTimeTrack_Click

End Sub
Hi David,
[quoted text clipped - 19 lines]
HELP!
David
 
D

disneygoof via AccessMonster.com

Crystal,

I would prefer not to pass out my entire database. Last night while making
some code adjustments, I desided to eliminate the filtering option and all is
working well now. Thanks for you help anyway.

Have a great day.
David
hi David,

I need to see your database -- without seeing your structure, it is hard
to say what the problem is -- and the problem may be your form, not the
code to open it. Would you email it to me? Make the subject the same
as this thread subject. I will post questions and comments here, not
privately.

strivepeace2006 at yahoo dot com

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
This checks to see if they are on a DIFFERENT Project.
[quoted text clipped - 42 lines]
 
D

disneygoof via AccessMonster.com

Crystal,

Not a problem and I thnak you and I apprecitate all you palnned to do for me.

I also decide this morning to change the FORM C design all together. I
occasionally get an error that pops up, this one I know what it is from, so
the form is not 100% working, and I can't accept that. Maybe when I re-write
it, the problem will go away. I will keep you posted, if you like?

David
 
D

disneygoof via AccessMonster.com

Solved by Updates and HotFixes. I did not realize out IT department did not
update office on a regular basis. NO ONE had service pack 3 for Office 2003..
.problem fixed.
Hi David,

you're welcome ;)

yes, let us know how it works out for you <smile>

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
[quoted text clipped - 23 lines]
 
D

disneygoof via AccessMonster.com

However, I new problem has arose...

My conditional Formatting on my forms is not longer working. Do you know of
an update that would have done this? I know it's not SP3 as I have always had
SP3 on my laptop, but over the past ferw days my laptop updated and now CF is
not working.

David
 
S

strive4peace

Hi David,

make sure your code compiles without errors

'~~~~~~~~~ Compile ~~~~~~~~~

Whenever you change code, references, or switch versions, you should
always compile before executing.

from the menu in a VBE (module) window: Debug, Compile

fix any errors on the yellow highlighted lines

keep compiling until nothing happens (this is good!)

~~
if you run code without compiling it, you risk corrupting your database

~~~~~ also be sure to use Option Explicit at the top of each module

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 
D

disneygoof via AccessMonster.com

Crystal,

No issues

David said:
Hi David,

make sure your code compiles without errors

'~~~~~~~~~ Compile ~~~~~~~~~

Whenever you change code, references, or switch versions, you should
always compile before executing.

from the menu in a VBE (module) window: Debug, Compile

fix any errors on the yellow highlighted lines

keep compiling until nothing happens (this is good!)

~~
if you run code without compiling it, you risk corrupting your database

~~~~~ also be sure to use Option Explicit at the top of each module

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
However, I new problem has arose...
[quoted text clipped - 25 lines]
 
D

disneygoof via AccessMonster.com

Crystal,

The only way I can fix CF, is to Remove CF from all form fields and put each
one in individually. I can't even group the controls and do it. This is
going to take a while...

David
Hi David,

make sure your code compiles without errors

'~~~~~~~~~ Compile ~~~~~~~~~

Whenever you change code, references, or switch versions, you should
always compile before executing.

from the menu in a VBE (module) window: Debug, Compile

fix any errors on the yellow highlighted lines

keep compiling until nothing happens (this is good!)

~~
if you run code without compiling it, you risk corrupting your database

~~~~~ also be sure to use Option Explicit at the top of each module

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
However, I new problem has arose...
[quoted text clipped - 25 lines]
 
S

strive4peace

Hi David,

you can remove and set format conditions using code -- but often, you
want to check each one as you do it, so code is only good if you know
exactly what you want. Here is an example to set a condition:

'~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub Form_Load()

'Create the condition.
Me.controlname.FormatConditions.Add acExpression, _
acGreaterThan, [Fieldname]

'Make the background red
With Me.controlname.FormatConditions(0)
.BackColor = 255
End With

End Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~

WHERE
controlname is the Name property of the control

you can run the code on, for instance, the form Load event. Once it is
set, you can comment the code because it does not need to run more than
once.

you can also set up a temporary command button and run it on the click
event -- just run it however.



Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*



Crystal,

The only way I can fix CF, is to Remove CF from all form fields and put each
one in individually. I can't even group the controls and do it. This is
going to take a while...

David
Hi David,

make sure your code compiles without errors

'~~~~~~~~~ Compile ~~~~~~~~~

Whenever you change code, references, or switch versions, you should
always compile before executing.

from the menu in a VBE (module) window: Debug, Compile
fix any errors on the yellow highlighted lines

keep compiling until nothing happens (this is good!)

~~
if you run code without compiling it, you risk corrupting your database

~~~~~ also be sure to use Option Explicit at the top of each module

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
However, I new problem has arose...
[quoted text clipped - 25 lines]
update office on a regular basis. NO ONE had service pack 3 for Office 2003..
.problem fixed.
 
D

disneygoof via AccessMonster.com

Crystal,

Thanks, I might try that.

David
Hi David,

you can remove and set format conditions using code -- but often, you
want to check each one as you do it, so code is only good if you know
exactly what you want. Here is an example to set a condition:

'~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub Form_Load()

'Create the condition.
Me.controlname.FormatConditions.Add acExpression, _
acGreaterThan, [Fieldname]

'Make the background red
With Me.controlname.FormatConditions(0)
.BackColor = 255
End With

End Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~

WHERE
controlname is the Name property of the control

you can run the code on, for instance, the form Load event. Once it is
set, you can comment the code because it does not need to run more than
once.

you can also set up a temporary command button and run it on the click
event -- just run it however.

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
[quoted text clipped - 41 lines]
 
S

strive4peace

you're welcome, David ;)

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*



Crystal,

Thanks, I might try that.

David
Hi David,

you can remove and set format conditions using code -- but often, you
want to check each one as you do it, so code is only good if you know
exactly what you want. Here is an example to set a condition:

'~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub Form_Load()

'Create the condition.
Me.controlname.FormatConditions.Add acExpression, _
acGreaterThan, [Fieldname]

'Make the background red
With Me.controlname.FormatConditions(0)
.BackColor = 255
End With

End Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~

WHERE
controlname is the Name property of the control

you can run the code on, for instance, the form Load event. Once it is
set, you can comment the code because it does not need to run more than
once.

you can also set up a temporary command button and run it on the click
event -- just run it however.

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
[quoted text clipped - 41 lines]
update office on a regular basis. NO ONE had service pack 3 for Office 2003..
.problem fixed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top