D
DawnTreader
Hello All
i must be totally dumb. i have been coding for a good 2 years on this app
and yet for some reason i cant get this to work.
Private Sub btnCloseSite_Click()
On Error GoTo Err_btnCloseSites_Click
Dim meopenArgs As String
If Me.cbServiceRepID = 1 Or IsNull(Me.cbServiceRepID) Then
MsgBox "Please choose a Service Representative, if in doubt choose
The Default.", vbOKOnly, "Service Representative Needed"
GoTo Exit_btnCloseSites_Click
End If
If Me.Dirty = True Then
If IsNull(Me.cbCustomerListID) Then
Me.cbCustomerListID.Value = Me.CustomerListID
End If
' DoCmd.RunCommand acCmdSaveRecord
'check to see if we are adding a site from a particular button
If Not IsNull(Me.OpenArgs) Then
meopenArgs = Me.Form.OpenArgs
Select Case meopenArgs
Case "ChangeSite"
Forms!pfrmChangeProductSite!cbChangeSiteList.Requery
Forms!pfrmChangeProductSite!cbChangeSiteList.SetFocus
Forms!zzMAINFORM.sfrmproductstositeinformation.Form.Requery
MsgBox "change site accomplished", vbOKOnly, "thingy"
Case "VisualPartsLink"
Forms!frmVisualPartsLink.Form.SetFocus
Forms!frmVisualPartsLink!cboSite.Value = 1
Forms!frmVisualPartsLink!cboSite.Requery
Forms!frmVisualPartsLink!cboSite.SetFocus
Forms!frmVisualPartsLink!cboSite.Value = Me.SiteID
MsgBox "visual part link accomplished", vbOKOnly, "thingy"
Case "ViewCustomerSiteDetails"
Forms!zzMAINFORM!SerialNumber.SetFocus
Forms!zzMAINFORM!sfrmproductstositeinformation.Requery
MsgBox "view customer site details accomplished",
vbOKOnly, "thingy"
Case "ViewAllSites"
Forms!zzMAINFORM!SerialNumber.SetFocus
Forms!zzMAINFORM!sfrmproductstositeinformation.Requery
MsgBox "view all sites accomplished", vbOKOnly, "thingy"
Case Else
Forms!zzMAINFORM!SerialNumber.SetFocus
Forms!zzMAINFORM!sfrmproductstositeinformation.Requery
MsgBox "had to do an else", vbOKOnly, "thingy"
End Select
End If
End If
DoCmd.Close acForm, "zySiteInformation"
Exit_btnCloseSites_Click:
Exit Sub
Err_btnCloseSites_Click:
MsgBox Err.Description
Resume Exit_btnCloseSites_Click
End Sub
everytime i test it i am getting no results, my combo box is not being
refreshed. i dont understand why. i have researched the syntax and have
changed it a few times to try and get the combo on the pfrmChangeProductSite
to requery. it doesnt even take the focus. do i need to do something
different? do i need to focus on the form first? this is so annoying because
from what i remember it was working at one time. this is on my close button,
the code that did work was on the close event of the form that this code is
on.
i know the case is working because i get the message box poping up. i have
even used breakpoints and watched it walk through the code. i am going to set
up a debug.print to see the value of the combo box, but at this point i
figured maybe someone would see something in this code i dont.
i am going to play around with it, move the code back to the close event of
the form, but i could really use any help and suggestions.
i must be totally dumb. i have been coding for a good 2 years on this app
and yet for some reason i cant get this to work.
Private Sub btnCloseSite_Click()
On Error GoTo Err_btnCloseSites_Click
Dim meopenArgs As String
If Me.cbServiceRepID = 1 Or IsNull(Me.cbServiceRepID) Then
MsgBox "Please choose a Service Representative, if in doubt choose
The Default.", vbOKOnly, "Service Representative Needed"
GoTo Exit_btnCloseSites_Click
End If
If Me.Dirty = True Then
If IsNull(Me.cbCustomerListID) Then
Me.cbCustomerListID.Value = Me.CustomerListID
End If
' DoCmd.RunCommand acCmdSaveRecord
'check to see if we are adding a site from a particular button
If Not IsNull(Me.OpenArgs) Then
meopenArgs = Me.Form.OpenArgs
Select Case meopenArgs
Case "ChangeSite"
Forms!pfrmChangeProductSite!cbChangeSiteList.Requery
Forms!pfrmChangeProductSite!cbChangeSiteList.SetFocus
Forms!zzMAINFORM.sfrmproductstositeinformation.Form.Requery
MsgBox "change site accomplished", vbOKOnly, "thingy"
Case "VisualPartsLink"
Forms!frmVisualPartsLink.Form.SetFocus
Forms!frmVisualPartsLink!cboSite.Value = 1
Forms!frmVisualPartsLink!cboSite.Requery
Forms!frmVisualPartsLink!cboSite.SetFocus
Forms!frmVisualPartsLink!cboSite.Value = Me.SiteID
MsgBox "visual part link accomplished", vbOKOnly, "thingy"
Case "ViewCustomerSiteDetails"
Forms!zzMAINFORM!SerialNumber.SetFocus
Forms!zzMAINFORM!sfrmproductstositeinformation.Requery
MsgBox "view customer site details accomplished",
vbOKOnly, "thingy"
Case "ViewAllSites"
Forms!zzMAINFORM!SerialNumber.SetFocus
Forms!zzMAINFORM!sfrmproductstositeinformation.Requery
MsgBox "view all sites accomplished", vbOKOnly, "thingy"
Case Else
Forms!zzMAINFORM!SerialNumber.SetFocus
Forms!zzMAINFORM!sfrmproductstositeinformation.Requery
MsgBox "had to do an else", vbOKOnly, "thingy"
End Select
End If
End If
DoCmd.Close acForm, "zySiteInformation"
Exit_btnCloseSites_Click:
Exit Sub
Err_btnCloseSites_Click:
MsgBox Err.Description
Resume Exit_btnCloseSites_Click
End Sub
everytime i test it i am getting no results, my combo box is not being
refreshed. i dont understand why. i have researched the syntax and have
changed it a few times to try and get the combo on the pfrmChangeProductSite
to requery. it doesnt even take the focus. do i need to do something
different? do i need to focus on the form first? this is so annoying because
from what i remember it was working at one time. this is on my close button,
the code that did work was on the close event of the form that this code is
on.
i know the case is working because i get the message box poping up. i have
even used breakpoints and watched it walk through the code. i am going to set
up a debug.print to see the value of the combo box, but at this point i
figured maybe someone would see something in this code i dont.
i am going to play around with it, move the code back to the close event of
the form, but i could really use any help and suggestions.