Form not showing (1 Viewer)

Boss1b

New member
Local time
Today, 04:16
Joined
Aug 14, 2012
Messages
9
Hi everyone!
I've got a 2010 access database that was coverted from an access backend to an sql backend. There is one form in the sql version that will not display. It works correctly in the access version. In the sql version, it produces a tab and a blank screen. If I go into design mode, properties, I can see the data for the combo-boxes. The form consists of 2 date fields, 2 combo boxes, 2 radio buttons, along with cancel and execute buttons. The code appears to be pretty straight forward. I have stepped thru the code, and by using debug.print, can see the data being set to the appropriate fields. Any thoughts as to what is going on? The code is below:

Private Sub cmdFpList_Click()
sFPFlag = "n"
DoCmd.OpenForm "frmForcedPoolReport", acNormal, , , acFormEdit, acWindowNormal
sFPFlag = "n"
End Sub

Private Sub Form_Load()
Dim SqlStr As String
Dim cn As New ADODB.Connection
Dim rs As ADODB.Recordset

Set cn = CurrentProject.AccessConnection
Set rs = New ADODB.Recordset

With rs
Set .ActiveConnection = cn
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
End With

Me.cmbLease.RowSource = ""
Me.cmbLease.AddItem "<< ALL LEASES >>", 0
Me.txtStartDate = #1/1/2004#
Me.txtEndingDate = Format(Now(), "mm/dd/yy")

SqlStr = "Select LR_LSM_LEASECOD From MRI_LRLMSTR Order By LR_LSM_LEASECOD"
rs.Open SqlStr

Do While rs.EOF = False

Me.cmbLease.AddItem rs("LR_LSM_LEASECOD")
rs.MoveNext

Loop
If rs.State = adStateOpen Then rs.Close

SqlStr = "select PetroID from LeaseInfo where PetroID is not null group by PetroID order by PetroID"
rs.Open SqlStr
Do While rs.EOF = False
Me.cmbOwner.AddItem rs("PetroId")
rs.MoveNext
Loop
If rs.State = adStateOpen Then rs.Close
End Sub


Thank you for your help!!!!
 
Are their records in the underlying tables? If not, set "Allow Additions" to true.
 
Hi, Sketchin,
Yes, there is data in the tables. While walking thru the code, I can see the "rs" values as the values are processed i.e. as in
Me.cmbOwner.AddItem rs("PetroID")

I can see the value by putting the cursor on the rs in the above code
and by putting debug.print rs("PetroID") in the loop statement. I went ahead and changed the add value to yes, but it didn't change anything.
Thanks!
boss1b
 
I have copied the working form from the access version into the database with the same results. One by one, I have removed the data fields from the form, commenting out the appropriate code. All that is left is a form with labels on it. It still will not show! What am I missing?
Thank you!
 
Wow, thats a strange one. Is "visible" set to yes for the labels?

Other than offering more completely obvious advice, I am stumped.
 
Sketchin, I'm don't know what the problem was. Yes, was set to visible in all locations I could find. As it wasn't a very busy form, I created a new one, literally copied the cells from the original form to the new one, (cut and paste), copied the code to the new module and it works. Weirdest thing I've ever seen! Thanks for looking at it. I kept the original form and will play with it some when I have time. If figure it out, I'll post it here.

Thanks again!
 

Users who are viewing this thread

Back
Top Bottom