473,419 Members | 1,698 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,419 software developers and data experts.

Open/Close form problem

Hello

I am using an If statement to test if a field = IsNull then close that
form and open another one. Here is the code:

Private Sub Form_Load()

If IsNull(Me.loc_fk) Then
MsgBox "This location does not have a compressor, click on New
Compressor to add one"
DoCmd.Close acForm, "compressors-view", acSaveNo
DoCmd.OpenForm "locations", acNormal
End If

End Sub

The code is working fine, but the problem is the "locations" Form is
not opening. I think the problem is because this form (the one that has
the Form_Load) opens when I click on a button from locations Form AND
this button closes the locations form and opens the Form_Load. Maybe
its a contradiction b/w one form trying to close it and the other one
saying to open it??? because I tried doing:

If IsNull(Me.loc_fk) Then
MsgBox "This location does not have a compressor, click on New
Compressor to add one"
DoCmd.Close acForm, "compressors-view", acSaveNo
DoCmd.OpenForm "compressors", acNormal
End If

End Sub

basically just changed the OpenForm from location to compressors and it
did work. The compressors form opened w/o any problem

Can somebody give me an idea of whats happening here??? I've been
trying to figured this out for 3 hours w/o any lucky

Please help

Thanks

Jul 26 '06 #1
4 1509
open form2
close form1

Jul 26 '06 #2

pi********@hotmail.com wrote:
open form2
close form1
I am sorry but I didnt not understand what i mena by
open form2
close form1
Thats what im doing and its not working

Jul 27 '06 #3

I already tried that before, and its not working either

Jul 27 '06 #4
I tried other way around and its working

Jul 27 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Seth Spearman | last post by:
Hey guys, I have the following code: '****************************************************** If Not Me.NewRecord Then Dim rs As DAO.Recordset Dim strBookmark As String Set rs =...
1
by: Jorge Ponte | last post by:
hi I have a Web User Control (ascx) - lets call it "My_WUC" - in a Web form. In that WUC I want have a textbox and a button. I want to click on the button and open a popup (I use javascript for...
13
by: Daniel Walzenbach | last post by:
Hi, Imagine the following situation: I have an asp.net application which allows uploading files to a SQL Server 2000 database (Files are stored as type "images"). As a next step I would like to...
14
by: Simon Abolnar | last post by:
I would like to know how to open child form from dialog form. Thanks for help! Simon
13
by: Academic | last post by:
I have a MDI form, sometimes child forms and sometimes forms that are neither If I close the app the child forms closing and closed event happens followed by the Mdi form receiving the...
5
by: Usman Jamil | last post by:
Hi I've a class that creates a connection to a database, gets and loop on a dataset given a query and then close the connection. When I use netstat viewer to see if there is any connection open...
19
by: =?Utf-8?B?R3JlZw==?= | last post by:
How can I tell via code if a Form is already open. Each time my forms load I have some initialization code that runs, but if the form is already open and hidden I don't want that initialization...
25
by: Andy_Khosravi | last post by:
I just recently changed my database that I'm running from a monolithic DB to a split FE/BE. The front end resides on the client machine and the BE resides on a network drive. I'm experimenting with...
3
by: rajashekar4dotnet | last post by:
how to open one form from the other form and close the first form if there are only two forms in windows application(VB.net) i had tried this method dim f as new form2 form2.show( )...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.