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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

switchboard strangeness!HELP!!

Status
Not open for further replies.

Ollie71

Technical User
Jun 4, 2008
20
AU
Hi have a wierd thing happening in my database. I have a form in which you can enter customer details and create a new record for that customer from it.

I also have a button which pops up a modal mini form to select a current customer name and pops that record up back into the customer details form so you can edit current customers details.

To find the matching record I pinched the find record code from a combo box menu I made on another form with the wizard.

I have modifed the code to match the customerid field on the combo box popup, to set a matching bookmark on the customerdetails form.

This is the code:
Dim rs As Object

Set rs = Forms![Customer Details].Recordset.Clone
rs.FindFirst "[CustomerId] = " & Str(Nz(Me![CustomerSearch], 0))
If Not rs.EOF Then Forms![Customer Details].Bookmark = rs.Bookmark
DoCmd.Close

The problem: I open the customer details form and push the button, select a name, the matching record pops up on the customer details form no problems <EXCEPT> when the switch board is open ?!?

It works fine if I open the form and click/select, the mini form closes and wol'a theres the correct record, you beauty.

However if run the customer details form from the switchboard and do the click/select nothing happends on the customer detail form. If i was using the keyword Me! I might understand it but as you can see I reference the customerdetails forms recordset explicitly.

I cant work out why having the switchboard form open would render my record matching on CustomerId suddenly inert?
 
Is it because the switchboard has the focus whilst it is open so any keyboard action is being carried out on the switchboard.
Does it do the same if you minimize the switchboard, and anyway why cant the switchboard be closed when the other form is opened?


Hampshire UK.

A fool and his money are soon parted - so you might as well send it to me!
 
Actually upon testing like you suggested it seems when run from the switchboard the select record dosent function at all, even if you close the switchboard after you select the main customer entry/edit form.

It seems if its run from the switchboard at all it dosent function, whether or not you minimize or even close the switchboard immediately after or not.

Cant figure this one out, but thanks for your suggestions :)
 
I put a watch on the bookmark in code with some interesting results.

When just the form is open the rs.bookmark has an absolute value of 1229 and the variable for customerId has the correct value 1207

However when run from the switchboard with the same code the varible still has the correct value 1207 (i select the same name each time) but the absolute value of the rs.bookmark is -1 which is obviously why the form does not change to display the correct record.

For some reason when the form is opened from the switchboard i can no longer read and manipulate the the bookmark of the form from the recordset clone. Anyone have any clue why the switchboard would affect this????
 
Why not simply this ?
Forms![Customer Details].Recordset.FindFirst "[CustomerId]=" & Me!CustomerSearch

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Well in frustration I deleted the switchboard and re-made it and guess what it works now.

The forms all do what they are supposed too. Must have been some underlying error causing it not function correctly which deleting must have reset.

Either way it works correctly now so thanks for your replies and efforts, I really appreciate it.

:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top