473,383 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

form does not display when it is opened

Hey guys, I'm a newbie to the forum and to access and require some major help. I accepted a new position with my co. with the chance to broaden my horizon but it has been more an up hill battle than I expected. With that said here is my dilemma: I inherited a DB that pretty complex with forms and loads of tables and queries, most of which I somewhat understand. I have a form that allows me and any other user to update the DB, however it does not display when it is opened. the same form when copied to another DB opens with out any problem.
can anyone assist me in the matter?
P.s if additional info is needed i.e., code etc please don't hesitate to ask.
Any help will be greatly appreciated.
Jun 5 '07 #1
22 2249
MMcCarthy
14,534 Expert Mod 8TB
Hey guys, I'm a newbie to the forum and to access and require some major help. I accepted a new position with my co. with the chance to broaden my horizon but it has been more an up hill battle than I expected. With that said here is my dilemma: I inherited a DB that pretty complex with forms and loads of tables and queries, most of which I somewhat understand. I have a form that allows me and any other user to update the DB, however it does not display when it is opened. the same form when copied to another DB opens with out any problem.
can anyone assist me in the matter?
P.s if additional info is needed i.e., code etc please don't hesitate to ask.
Any help will be greatly appreciated.
If the form works ok in another database it is probably not a corruption issue. That's the good news (LOL)

OK

How is this form being opened in the database? Is it through a switchboard, another form or by just clicking on the form in the list?

If it is through another form I will need to see the code behind the command button used to open the form.

I will also need to see any code behind the on load and on open events of the form being opened.

This could take a while to figure out.
Jun 6 '07 #2
It's being opened from another form by clicking on the form.

Here's the code:
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Form_Load()
  3. 'Clean_House
  4. Dim rs As Recordset
  5.  
  6.     Form_frmMain.Caption = Replace(CurrentProject.Name, "HRDB.mdb", "") & " - " & Form_frmMain.Caption
  7.     Set rs = New Recordset
  8.     prevForm = Me.Name
  9.  
  10.     If CurrALevel = "Administrator" Or CurrALevel = "Developer" Then
  11.         If reLogin = True Then
  12.             cmdAdmin.Visible = True
  13.             cmdLogin.Visible = True
  14.             cmd570.Visible = True
  15.             Me.lblUser.Caption = "User: " & CurrName & " -- Level: " & CurrALevel
  16.         End If
  17.         cmdGSMUpdt.Visible = True
  18.     Else
  19.         cmdAdmin.Visible = False
  20.         cmdLogin.Visible = False
  21.         cmdGSMUpdt.Visible = False
  22.         Me.lblUser.Caption = ""
  23.     End If
  24.  
  25.     If CurrRDRUpdt = True Then
  26.         cmdUpdateRDR.Visible = True
  27.     Else
  28.         cmdUpdateRDR.Visible = False
  29.     End If
  30.  
  31.     If CurrSTView = True Then
  32.         cmdStaffing.Visible = True
  33.     Else
  34.         cmdStaffing.Visible = False
  35.     End If
  36.  
  37.     Load_Config_Info
  38.     cboReport.RowSource = ""
  39.     rs.Open "select * from ReportList order by displayname", CurrentProject.Connection
  40.     rs.MoveFirst
  41.  
  42.     Do Until rs.EOF
  43.         If IsNull(rs!securitycriteria) = True Then
  44.             Me.cboReport.AddItem rs!DisplayName
  45.         ElseIf rs!securitycriteria = "GSM" And CurrGSMView = True Then
  46.             Me.cboReport.AddItem rs!DisplayName
  47.         ElseIf rs!securitycriteria = "LBM" And CurrLBMView = True Then
  48.             Me.cboReport.AddItem rs!DisplayName
  49.         ElseIf rs!securitycriteria = "RDRConf" And CurrRDRConf = True Then
  50.             Me.cboReport.AddItem rs!DisplayName
  51.         ElseIf rs!securitycriteria = "PEND" And CurrPendVu = True Then
  52.             Me.cboReport.AddItem rs!DisplayName
  53.         Else
  54.             'Nothing
  55.         End If
  56.         rs.MoveNext
  57.     Loop
  58.  
  59.     rs.Close
  60.     Set rs = Nothing
  61.  
  62.     cboReport.Value = "Please Choose A Report from this dropdown list"
  63.     reLogin = False
  64. End Sub
  65. -------------------------------------------
  66.  
  67. Private Sub Load_Config_Info()
  68. Dim rs As Recordset
  69.     Set rs = New Recordset
  70.  
  71.     rs.Open "select LASTUPDATE as maxdat from CONFIG", CurrentProject.Connection
  72.     LastRDRUpdate = FormatDateTime(rs.Fields("maxdat").Value, vbShortDate)
  73.  
  74.     rs.Close
  75.     rs.Open "select prevrdrupdt from config", CurrentProject.Connection
  76.     PrevRDRUpdate = Format(rs.Fields("prevrdrupdt").Value, "mm/dd/yyyy")
  77.     rs.Close
  78.  
  79.     If PrevRDRUpdate = #12:00:00 AM# Then PrevRDRUpdate = #11/9/2006#
  80.     ThisSDate = LastRDRUpdate
  81.     ThisEDate = LastRDRUpdate
  82.  
  83.     Set rs = Nothing
  84. End Sub
  85.  
  86.  
Jun 7 '07 #3
missinglinq
3,532 Expert 2GB
I'm a little confused about a couple of things.

What do you mean by "doesn't display?" Nothing happens, or none of your controls show up?

What's the Record Source of the form?

Obviously the Record Source is present in the second form. Is it present and does it actually have data in it in the first database?
Jun 7 '07 #4
The actual form which allows me to view/add/delete info does not show up. A blank image is display.

The record source is a table in access, all data are present

I'm a little confused about a couple of things.

What do you mean by "doesn't display?" Nothing happens, or none of your controls show up?

What's the Record Source of the form?

Obviously the Record Source is present in the second form. Is it present and does it actually have data in it in the first database?
Jun 8 '07 #5
Here's the code for the form:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4.  
  5. Private Sub cmdAdd_Click()
  6. cmdSave.Visible = True
  7. cmdCXL.Visible = True
  8. cmdNewBase.Visible = False
  9. cmdOpenUpdt.Visible = False
  10. Form_frmRELO570.AllowAdditions = True
  11. Form_frmRELO570.DataEntry = True
  12. Form_RELO570.Visible = False
  13.  
  14. End Sub
  15.  
  16. Private Sub cmdCXL_Click()
  17. Form.Undo
  18. cmdSave.Visible = False
  19. cmdNewBase.Visible = True
  20. cmdOpenUpdt.Visible = True
  21. Form_frmRELO570.DataEntry = False
  22. Form_frmRELO570.AllowAdditions = False
  23. Form_RELO570.Visible = True
  24. cmdCXL.Visible = False
  25. End Sub
  26.  
  27. Private Sub cmdDel_Click()
  28. Dim CURWKR As String
  29. CURWKR = fullname
  30. If MsgBox("ARE YOU SURE YOU WANT TO DELETE " & Chr(13) & "WORKER ID: " & WKR_ID & " - " & fullname, vbYesNo) = vbYes Then
  31.  
  32. Form_RELO570.RecordSource = ""
  33. DoCmd.RunSQL "DELETE FROM RELO570 WHERE FULLNAME = '" & CURWKR & "'"
  34. Form_RELO570.RecordSource = "RELO570"
  35. End If
  36. End Sub
  37.  
  38. Private Sub cmdEXIT_Click()
  39. DoCmd.Close
  40. End Sub
  41.  
  42. Private Sub cmdNewBase_Click()
  43. RecordSource = ""
  44. Form_RELO570.RecordSource = ""
  45. DoCmd.RunSQL "SELECT * INTO RELO570ORIGIN" & Format(Now(), "YYYYMMDDHHMMSS") & " FROM RELO570ORIGIN"
  46. DoCmd.RunSQL "SELECT * INTO RELO570ORIGIN FROM 570EXIT"
  47. DoCmd.RunSQL "DELETE FROM RELO570 WHERE INSTR(COMMENTS,'Remove from move sheet.')<>0"
  48. MsgBox "A new baseline for the excel spreadsheet has been created", vbOKOnly
  49. Form_RELO570.RecordSource = "RELO570"
  50. End Sub
  51.  
  52. Private Sub cmdOpenUpdt_Click()
  53. Shell "excel.exe " & MyDefDir & "\570Relocation\GNS570to222M&TReport.xlt", vbMaximizedFocus
  54. End Sub
  55.  
  56. Private Sub cmdSave_Click()
  57. cmdCXL.Visible = False
  58. cmdNewBase.Visible = True
  59. cmdOpenUpdt.Visible = True
  60. Form_frmRELO570.DataEntry = False
  61. Form_frmRELO570.AllowAdditions = False
  62. Form_RELO570.Visible = True
  63. cmdSave.Visible = False
  64. End Sub
  65.  
  66. Private Sub Form_Load()
  67. Form_frmMain.Visible = False
  68. End Sub
  69.  
  70. Private Sub Form_Unload(Cancel As Integer)
  71. Form_frmMain.Visible = True
  72. End Sub
  73.  
Jun 8 '07 #6
MMcCarthy
14,534 Expert Mod 8TB
The actual form which allows me to view/add/delete info does not show up. A blank image is display.

The record source is a table in access, all data are present
Are you saying you get a blank empty form? This happens when there is not record to display.
Jun 8 '07 #7
Not a blank form but rather an image. In other words there's an outline of the form. It work fine a few day ago
Jun 8 '07 #8
MMcCarthy
14,534 Expert Mod 8TB
Not a blank form but rather an image. In other words there's an outline of the form. It work fine a few day ago
When I say blank I mean no controls. Just a grey shape (or whatever background it had)

Open the form in design view and have a look at the Record source property of the form. If this is a table try opening the table directly. If it's a query try running the query.
Jun 8 '07 #9
Then you are correct in your assumption
Jun 8 '07 #10
MMcCarthy
14,534 Expert Mod 8TB
Then you are correct in your assumption
Did you try opening the table or query behind the form as I suggested?
Jun 8 '07 #11
The table opens up fine
Jun 8 '07 #12
MMcCarthy
14,534 Expert Mod 8TB
The table opens up fine
OK if you try to open the form directly and not from the other form what happens?
Jun 8 '07 #13
I encounter the same result
Jun 8 '07 #14
MMcCarthy
14,534 Expert Mod 8TB
I encounter the same result
OK open the form in design view and go to properties.
  1. As previously mentioned check that the Record Source under the Data tab is correct.
  2. Check that Filter Property is not set
  3. There are two forms referred to in your code frmRELO570 and frmMain. Are either of these the current form? If not what is the current forms name
Once you check these we can move forward.
Jun 8 '07 #15
Frm RELO570 is the form in questioned
Jun 8 '07 #16
MMcCarthy
14,534 Expert Mod 8TB
Frm RELO570 is the form in questioned
OK leave it with me. I have to go out for a couple of hours. I'll look at it when I get back unless someone beats me to it.
Jun 8 '07 #17
This will be appreciated greatly
Jun 8 '07 #18
missinglinq
3,532 Expert 2GB
And just as an aside while we try to figure this out. It'll make life much easier for you as while as for us, anytime we try to help you, if you change how you refer to the current form in VBA code.

If the current form is named frmRELO570 and you are working in the VBE, which is to say the code window, behind that form, instead of writing, for instance

frmRELO570.AllowAdditions = True

simply write

Me.AllowAdditions = True

The Me is shorthand, if you will, for the current form's name. This can be used anytime you're referring to the form's properties! Referring to any other form from frmRELO570 you would, of course, still use the long method for that other form.
Jun 8 '07 #19
FishVal
2,653 Expert 2GB
Here's the code for the form:
Option Compare Database
Option Explicit


Private Sub cmdAdd_Click()
cmdSave.Visible = True
cmdCXL.Visible = True
cmdNewBase.Visible = False
cmdOpenUpdt.Visible = False
Form_frmRELO570.AllowAdditions = True
Form_frmRELO570.DataEntry = True
Form_RELO570.Visible = False

End Sub

Private Sub cmdCXL_Click()
Form.Undo
cmdSave.Visible = False
cmdNewBase.Visible = True
cmdOpenUpdt.Visible = True
Form_frmRELO570.DataEntry = False
Form_frmRELO570.AllowAdditions = False
Form_RELO570.Visible = True
cmdCXL.Visible = False
End Sub

Private Sub cmdDel_Click()
Dim CURWKR As String
CURWKR = fullname
If MsgBox("ARE YOU SURE YOU WANT TO DELETE " & Chr(13) & "WORKER ID: " & WKR_ID & " - " & fullname, vbYesNo) = vbYes Then

Form_RELO570.RecordSource = ""
DoCmd.RunSQL "DELETE FROM RELO570 WHERE FULLNAME = '" & CURWKR & "'"
Form_RELO570.RecordSource = "RELO570"
End If
End Sub

Private Sub cmdEXIT_Click()
DoCmd.Close
End Sub

Private Sub cmdNewBase_Click()
RecordSource = ""
Form_RELO570.RecordSource = ""
DoCmd.RunSQL "SELECT * INTO RELO570ORIGIN" & Format(Now(), "YYYYMMDDHHMMSS") & " FROM RELO570ORIGIN"
DoCmd.RunSQL "SELECT * INTO RELO570ORIGIN FROM 570EXIT"
DoCmd.RunSQL "DELETE FROM RELO570 WHERE INSTR(COMMENTS,'Remove from move sheet.')<>0"
MsgBox "A new baseline for the excel spreadsheet has been created", vbOKOnly
Form_RELO570.RecordSource = "RELO570"
End Sub

Private Sub cmdOpenUpdt_Click()
Shell "excel.exe " & MyDefDir & "\570Relocation\GNS570to222M&TReport.xlt", vbMaximizedFocus
End Sub

Private Sub cmdSave_Click()
cmdCXL.Visible = False
cmdNewBase.Visible = True
cmdOpenUpdt.Visible = True
Form_frmRELO570.DataEntry = False
Form_frmRELO570.AllowAdditions = False
Form_RELO570.Visible = True
cmdSave.Visible = False
End Sub

Private Sub Form_Load()
Form_frmMain.Visible = False
End Sub

Private Sub Form_Unload(Cancel As Integer)
Form_frmMain.Visible = True
End Sub

Could you clarify how many forms actually are involved in discussion.
1) You have frmMain which visibility depends on whether the form with code above loaded or unloaded.
2) You have a form the code of which you have provided. Plz, provide its name and the way it is being opened (from frmMain to my mind).
3) The code above deals with frmRELO570 and RELO570 forms in a really bizzare way. What it actually supposed to do?

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub cmdAdd_Click()
  3.     cmdSave.Visible = True
  4.     cmdCXL.Visible = True
  5.     cmdNewBase.Visible = False
  6.     cmdOpenUpdt.Visible = False
  7.     Form_frmRELO570.AllowAdditions = True
  8.     Form_frmRELO570.DataEntry = True
  9.     Form_RELO570.Visible = False
  10.  
  11. End Sub
  12.  
4) In msg#3 you've provided Form_Load event handler code. To what form does it relate?

Will be glad to help you when you will clarify me forms relationships.
Jun 9 '07 #20
MMcCarthy
14,534 Expert Mod 8TB
I have edited the code slightly including commenting out some lines that made the form visible and invisible. After adding this code, open the form in design view and make sure the visible property is set to yes.

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit 
  3.  
  4. Private Sub cmdAdd_Click()
  5.     cmdSave.Visible = True
  6.     cmdCXL.Visible = True
  7.     cmdNewBase.Visible = False
  8.     cmdOpenUpdt.Visible = False
  9.     Me.AllowAdditions = True
  10.     Me.DataEntry = True
  11.     'Me.Visible = False
  12. End Sub
  13. Private Sub cmdCXL_Click()
  14.     Me.Undo
  15.     cmdSave.Visible = False
  16.     cmdNewBase.Visible = True
  17.     cmdOpenUpdt.Visible = True
  18.     Me.DataEntry = False
  19.     Me.AllowAdditions = False
  20.     'Me.Visible = True
  21.     cmdCXL.Visible = False
  22. End Sub
  23. Private Sub cmdDel_Click()
  24. Dim CURWKR As String
  25.     CURWKR = FullName
  26.     If MsgBox("ARE YOU SURE YOU WANT TO DELETE " & Chr(13) & "WORKER ID: " & WKR_ID & " - " & FullName, vbYesNo) = vbYes Then
  27.         Me.RecordSource = ""
  28.         DoCmd.RunSQL "DELETE FROM RELO570 WHERE FULLNAME = '" & CURWKR & "'"
  29.         Me.RecordSource = "RELO570"
  30.     End If
  31. End Sub
  32. Private Sub cmdEXIT_Click()
  33.     DoCmd.Close
  34. End Sub
  35. Private Sub cmdNewBase_Click()
  36.     Me.RecordSource = ""
  37.     DoCmd.RunSQL "SELECT * INTO RELO570ORIGIN" & Format(Now(), "YYYYMMDDHHMMSS") & " FROM RELO570ORIGIN"
  38.     DoCmd.RunSQL "SELECT * INTO RELO570ORIGIN FROM 570EXIT"
  39.     DoCmd.RunSQL "DELETE FROM RELO570 WHERE INSTR(COMMENTS,'Remove from move sheet.')<>0"
  40.     MsgBox "A new baseline for the excel spreadsheet has been created", vbOKOnly
  41.     Me.RecordSource = "RELO570"
  42. End Sub
  43. Private Sub cmdOpenUpdt_Click()
  44.     Shell "excel.exe " & MyDefDir & "\570Relocation\GNS570to222M&TReport.xlt", vbMaximizedFocus
  45. End Sub
  46. Private Sub cmdSave_Click()
  47.     cmdCXL.Visible = False
  48.     cmdNewBase.Visible = True
  49.     cmdOpenUpdt.Visible = True
  50.     Me.DataEntry = False
  51.     Me.AllowAdditions = False
  52.     'Me.Visible = True
  53.     cmdSave.Visible = False
  54. End Sub
  55. Private Sub Form_Load()
  56.     Forms!frmMain.Visible = False
  57. End Sub
  58. Private Sub Form_Unload(Cancel As Integer)
  59.     Forms!frmMain.Visible = True
  60. End Sub
  61.  
  62.  
Jun 11 '07 #21
Thx greatly, this is some good stuff. how can someone like me with no prior knowledge of VB learn relatively quickly?
Jun 12 '07 #22
MMcCarthy
14,534 Expert Mod 8TB
Thx greatly, this is some good stuff. how can someone like me with no prior knowledge of VB learn relatively quickly?
Unfortunately, it's not really a quickly learned language. You can pick up some basics fairly easily by using the command button wizard and examining the code created and convert existing macros to VBA and examine how VBA handles the macro functions.

There is also a number of tutorials on various topics in the Articles section of this site. There is an indexed list of them here. Opening the help file from the VBA editor window will also give you an extensive help section.

Mary
Jun 12 '07 #23

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: ColinWard | last post by:
Hi. I have a form which has as its recordsource an SQL string. The SQL String is as follows: SELECT * from CONTACTS where false. this ensures that there is no data loaded in the form when the...
5
by: Lyn | last post by:
Hi, I hope someone can help. I have a main form which mostly fills the Access window. In the bottom half of this form I have a tab control to display various types of data related to the main...
3
by: Susan Bricker | last post by:
Greetings. I have three forms that are open at the same time. They are related and cascading. The first form (frmEventAdd) is the anchor. Each event can have many Trials. The second form is...
7
by: Terry | last post by:
I have a Mainform with a Statusbar. When opening another form or doing some processing I want to display info in the Statusbar of the Mainform. I have read a lot of articles on this & have come up...
6
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox...
2
by: MLH | last post by:
A97 Am having difficulty displaying graph in Form View that I see fine in graph control on form opened in design view. I know I'm doing something wrong. If I open the form in design view - I...
7
by: Jwe | last post by:
Hi, I've written a program which has both a command line interface and Windows form interface, however it isn't quite working correctly. When run from command line with no arguments it should...
2
by: dstorms | last post by:
Something very strange going on here! Don't know where dstorms original post went! The post, in essence, stated that his form, containing a checkbox and a textbox, opened fine if opened...
3
by: Salad | last post by:
Using A97, SP2, most current jet35. I have a search form. The op enters an id to search/find. If found, a data entry form is presented for that id. This form has 7 or 8 combos, a bunch of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.