Chipman/Barrow Access Dev. Guide to SQL P 595-596

MIMF

New Member
Joined
Apr 4, 2002
Messages
16
My last experience posting a question on here was not great but it did finally yield the answer.

I am moving an Access 2000 database onto SQL Server and have found what seems like exactly what I need to do on page 595 of the following book

Microsoft Access Developers Guide to SQL (Chipman/Barrow)

I have spent 2 days on this and am ready to burst. I cannot get the Code to run . This is what my code looks like in the Open Report button.

Sub Cntry()

If IsNull(Me.cboSelectC) Then
DoCmd.OpenReport "ReviewsbyCountry", View:=acViewPreview
Else
DoCmd.OpenReport "ReviewsbyCountry", View:=acViewPreview, WhereCondition:="ReviewsbyCountry=" & Me!cboSelectC
End If
Me.cboSelectC = Null
End Sub

My mdb Access file is linked to the SQL server but when I try to work with the code on the button, it freezes, tells me the network connection is gone, won't let me work on the button anymore.

Any ideas? Step by step is my speed
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
To be honest, what you describe doesn't really make sense.
Making changes to code shouldn't have anything to do with whether there is or is not a connection to the database. You should be able to pull the ethernet cable out and modify all you wish without even noticing.

Is the Access client on a local machine or a share drive?
Just how large is the SQL database?
Is there other code on the Form?

I'm wondering if there might be other code on your form, possibly in a the Load/Open events that runs as the form is opened that is doing something with your backend.

About the code. Looks like a nice little clip. Only thing to watch is to make sure that the Button Name is precisely as listed (cboSelectC) and that you have the list populated with valid Country field values. If you used the Wizard interface to 'build' the button, that'd work just fine.

Sorry, I'm struggling with the editor here and my proxy server.

What I wanted to add is - it's possible that your subroutine is not executing. You can't just add a Sub to a form and expect it to run. You have to connect it to an Event Action done to one of the form controls. A button, for example, is a control. One of it's events is 'Click' which causes it to execute any code it might have for that event.

One possible way to set this up would be to create a button (don't use the wizard interface), open up design mode and right click it opening properties. Go to the Event Tab and select one (Click is good). This should open up the code window inside the 'event' subroutine. Copy your code here.

Alternatively, the same click event you just made could have a function call to your existing subroutine which should run as-is.

Neither of these last two items should create the problems you describe (database lockup)

Mike
 
Upvote 0
Mike

Thanks for taking the time to help me out. I really appreciate it.

I have managed to get the code to run - it opens up the Report beautifully.

Now I am trying to 'adapt' the code to open a Form that shows continuous forms of all records that meet the criterion selected in the Combo box. I posted it as a new question - any ideas?

Cynthia
 
Upvote 0

Forum statistics

Threads
1,221,674
Messages
6,161,215
Members
451,691
Latest member
fjaimes042510

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top