Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to program a switchboard button?

Status
Not open for further replies.

murk

Technical User
Nov 26, 2002
16
0
0
US
I have a switchboard button (edit/delete) or (print) that I want to program to ask what policy number before opening up the form or report so that it opens up that certain policy.
 
You could use the following code in the AfterUpdate event of a combo box that shows the user all legitimate policy numbers.

Dim lngSID As Long

Const conCannotGoToRecord = 2105

If Not IsNull(cmbFind) Then
lngSID = Me.cmbFind
Me.RecordsetClone.FindFirst "[ServId] = " & lngSID
Me.Bookmark = Me.RecordsetClone.Bookmark
Me.cmbFind.Value = Null
Else
Me.cmbFind.Value = Null
Exit Sub
End If

This assumes a long integer for policy number - FindFirst would changer for a string

something like "[ServId] = "'& strSID & "'"

you would want to account for user entry 'not in list' (see Access help), etc. You could also run code from a button instead of afterUpdate of combo box. Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top