473,394 Members | 1,702 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.

Where statement not working on OpenForm when writing a new record

reginaldmerritt
201 100+
Hi,

I have 1 table and 2 forms. 1 form for entering main data, i.e. Primary Key, Name, Address, etc. Another form for entering extra information if required.

The first form has a button to open the second form. This works perfectly for any current records but doesn't work for new records. Instead the second form opens as a new record itself.

The where statment only seems to work if the record is not new ????? I've been searching for hours and can't find this problem any where else.

The code i'm using to open the second form is
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "AdditionalInformation",acNormal,,"[FormNumber] = '" & Me.FormNumber & "'"
  2.  
(FormNumber is a primary key)

Any ideas on what could be happening here????

Thanks.
Aug 17 '10 #1

✓ answered by missinglinq

My guess is that the new record on the first form hasn't been saved when you move to the second form. Immediately before the line of code you posted place this line:

If Me.Dirty Then Me.Dirty = False

and see if that doesn't do the trick!

Linq ;0)>

4 1122
reginaldmerritt
201 100+
I guess everyone is a stumped at this as me.
Aug 21 '10 #2
missinglinq
3,532 Expert 2GB
My guess is that the new record on the first form hasn't been saved when you move to the second form. Immediately before the line of code you posted place this line:

If Me.Dirty Then Me.Dirty = False

and see if that doesn't do the trick!

Linq ;0)>
Aug 21 '10 #3
reginaldmerritt
201 100+
Worked a treat, well done.
Thanks
Aug 21 '10 #4
missinglinq
3,532 Expert 2GB
Glad we could help!

Linq ;0)>
Aug 21 '10 #5

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

Similar topics

2
by: G.J. v.d. Kamp | last post by:
Hi all, I have one for all the blackbelters out there: is there a way i can make a stored procedure where i can control the where statement with variables? I have to do some complex...
1
by: Daniel | last post by:
when writing out a file from .net, when is the file created? after the bytes are all written to the hard drive or before the bytes are written to the hard drive?
4
by: Tom Walker | last post by:
I cannot get the WHERE statement to work correctly unless I use a literal with the LIKE. I want to use a working storage data name so that I can vary the WHERE statement. Example that works: ...
1
by: Justin | last post by:
I have a variable string "myvar" and I need to pass it to the WHERE clause of a SELCET statement I have tried myvar.ToString(), Cint, parse and convert. The Select statement works fine when I...
5
by: rdemyan via AccessMonster.com | last post by:
I have a table with about 80 fields. I'm using an import process to populate the table. It works fine, except for the following: Users generally don't specify values for a lot of numerical...
0
by: vbnetprogramer | last post by:
How Can I Ignore Accsents and diacritical marks in WHERE statement? i use sql statment for searching and i wont to search in text filds where some accent and diacritical marks have been enterd. ...
3
by: dhutton | last post by:
SQL Server 2000 How do you write your query to check for blank (empty) cells? Need to check 3 columns. ColumnA, ColumnB and ColumnC. I need to grab the data in ColumnA ONLY if ColumnB and...
6
by: Aussie Rules | last post by:
Hi, In all my coding to date, i have been dealing with multiple results in my dataset, looping through them with SqlDataAdapterContactProfile.Fill(contact, "Profile") For Each pRow In...
9
imrosie
by: imrosie | last post by:
Hello Experts, It's going to take one to figure this out. My Order form is supported by a query of two tables (Customers and Orders). There is a subform within the Form for entering in the new...
2
by: =?Utf-8?B?S3VtYXI=?= | last post by:
I am using granados telnet client for connecting to the telnet and get the data from it. Every thing appears to be going smooth. But for some reason when I try to write the byte data to a string or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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?
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
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.