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

Open frm in Add mode

18
Hello,
I need simple help!
I have a form with a field (DrsName) which is a combo box that looks up values in another table (Drs List). When I come across a name that is not in the list, I need to open the form (Drs List) and add the name. for which I added a cute button. I am having 2 problems:
1) I cannot get the button to open the form in add mode, as I don't want the users to accidently type over the data, I just want to be able to ADD a new name. or at least open the form in data sheet view! I am able to do it in the switchboard but not within my form!
2) when I add the name and come back to my form, the list is not updated until I close the form and re-open it again. which is a problem as I need to find the patient I was working on and choose the name from the list and continue entering the data.

I am sure there is a simple way to do this... I just can't figure it out!

Thanks for the help.
Nour
Dec 1 '08 #1
4 8912
DonRayner
489 Expert 256MB
To open your form in add mode you need to use the following code, replace FormName with the name of your form.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "FormName", , , , acFormAdd
  2.  
To have the combobox updated after you add a new item add the following to the close event of your new form. Replace MyForm with the name of your form and MyCombobox with the name of your combobox

Expand|Select|Wrap|Line Numbers
  1. Forms!MyForm!MyCombobox.requery
  2.  
Dec 1 '08 #2
Nour469
18
Hi,
Thanks for your reply, The first one worked like magic and my form opens in Add mode, But the second one did not work, it keeps giving my errors, not accepting form name...
Dec 2 '08 #3
DonRayner
489 Expert 256MB
@Nour469
It should work. Please post back the exact text from the error that you are getting.
Dec 2 '08 #4
Nour469
18
Hi Donrayner,

The name of my form was Referring Drs list and it was highlighting the "Drs: in yello but I changed it to: ReferringDrsList which is now fine. the name of my combo box is: referringDr. Now the combo box is is the "Main Form"

I am opening the form: ReferringDrsList and on close I am typing in the code builder:

Forms!ReferringDrsList!ReferringDr.requery

and now I am getting the Run-Time error '2465' can't find the field "ReferringDr"
(The combo box is in the main form, and I have a button whithin the main form to open the form "ReferringDrsList" .....

What am I doing wrong!?
Nour
Dec 2 '08 #5

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

Similar topics

1
by: Eric Pederson | last post by:
WryPyY's- I've come across this file operation in others' code and have not seen any documentation for it: the use of "t" in the mode of file opening, such as: f1=open(somefile, 'at')...
6
by: Mateo | last post by:
Hi! I tried to open page in new window with window.open(...) method. open() method supports fullscreeen mode, but I would like to open new maximized window with tiltle bar only.... Any idea...
0
by: Mark Phillips | last post by:
Hello, I am having a problem in which a file can get stuck open when a thread that is attempting to write to it gets aborted (ThreadAbortedException occurs). The log file gets stuck open until...
5
by: ehui928 | last post by:
The following program is used to open a file in mode both read and append, but it has a problem that the file can't be opened. #include <iostream> #include <fstream> #include <cstdlib> ...
1
by: Sorin Schwimmer | last post by:
Hi, I tried for the first time a Tix Tree, so, if my question is naive, I apologize upfront. The following code: <code> from Tix import * r=Tk()
7
by: freegnu | last post by:
hi all, i dont dont whats the difference, and the different bettwen flags and mode
2
by: tubby | last post by:
Does a py script written to open and read binary files on Windows affect files on a Linux or Mac machine in a negative way? My concern is portability and safety. I want scripts written within...
6
by: =?Utf-8?B?TUNI?= | last post by:
I try to open a log file that is logging infomation by another process: StreamReader sr = File.OpenText(filePath); I got the exception message: The process cannot access the file...
0
by: BHerz | last post by:
I have an Access 2007 application which displays the File Name of documents located on a Windows SharePoint V3 Site. When you click on the file name the file opens in "Read Only" format. I am not...
6
by: sebastian.noack | last post by:
Hi, is there a way to or at least a reason why I can not use tarfile to create a gzip or bunzip2 compressed archive in the memory? You might might wanna answer "use StringIO" but this isn't...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.