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!

Nothing is Working!!! - Switchboard edit/delete button

Status
Not open for further replies.

murk

Technical User
Nov 26, 2002
16
0
0
US
I am trying to program an edit/delete button on a switchboard to open a certain policy number for editing etc. I know this is done through the properties, event procedure. But nothing is working. Please, please can I get the EXACT verbage to do this? This is what I already have tried and isn't working:

Private Sub OpenFormButton_Click()

Dim stDocName As String
Dim stLinkCriteria As String
Dim stPolicy as Variant

stDocName="tblBusAutoDec1"
stPolicy=InputBox ("Enter Policy Number?")
stLinkCriteria="[PolicyNumber]=" & stPolicy
DoCmd.OpenForm stDocName,,,stLinkCriteria

End Sub


Thanks soooo much!!!!

Jennifer
 
You haven't said what it's doing wrong. Is it just not opening the form? Or going to the wrong record?

Is 'tblBusAutoDec1' definitely a form, as this naming convention is normally reserved for tables.
Does the policy number contain letters? If so you would have to amend your code to read:

stLinkCriteria="[PolicyNumber]='" & stPolicy & "'"

If this doesn't work, please supply more informaiton on what it's doing wrong.
 
Actually it is a form so I changed that and it still is not opening. Yes the Policy numbers have letters in them and I changed it to what you said and that didn't work either.

Any other suggestions?

Thanks a bunch!

Jennifer
 
Jennifer,
it must be something else - if the policy number definitely contains letters then keep the notation I gave you even if doesn't seem to make a difference.
I can only advise the folowing approach to troubleshoot it one component at a time.

1. Temporarily take out the filter criteria when opening the form, to ensure the form is being opened, so it's just docmd.openform stDocName. If it doesn't open, investigate otherwise ..
2. Instead try DoCmd.OpenForm stDocName,,,"[PolicyNumber]='a123'" where a123 is a policy number, be sure to include the quotes. If this doesn't work, then make sure the policy number is stored correctly in that field in that table.
3. If '2' worked, then it's down to what inputbox isreturning, make sure there's no spaces.

This prob sounds like obvious stuff but it's all I can think of at the moment!
 
Hi

I can only agree with SarahG.

My approach would be to put a break point on:

stDocName="tblBusAutoDec1"

and step thru the code Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top