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

Force an empty form to get inserted, in background (without changingfocus, selection, etc.)

Hi!

Do you know how to put a form's Access-Visual-Basic-code that will force
the form to be inserted, while the user has not type anything in the form,
without changing focus, selection, etc.?

Here is the story.

I have this structure:

Table1 <-one-many-> Table2 <-one-many-> Table3

The forms follow that structure:

Form2 (of Table2) subform of Form1 (of Table1)
Form3 (of Table3) subform of Form2 (of Table2)

Now, the records in Table2, although have their own fields, that fields
not always filled by users, and sometime just act as "holder" for a group
of Table3's records. So in the form, sometime users have nothing to type
in Form2, but want to type into Form3 directly. But since Form2 is not
typed in yet, the record is not created yet, and therefore what they type
in Form3 will just gone (not linked to anything).

So what I tried to do, is but an event handler (of BeforeInsert event) in
Form3, calling another code in Form2 or other place if necessary, get that
form "inserted" (get the record created). However, since this will happen
in the middle of the user typing in Form3, it should happen without
changing focus and selection.

So far the only thing can do the insertion, is by having a code moving
some data into 1 or more fields in Form2, and then call the method Requery
or Refresh from Form2. Unfortunately, this reset the Forms display, with
Requery the focus shifted to the first field in Form2, with the Refresh,
either the typing hairline change into selection of that particular field
(in Form3), or Form3 get reset (focus to first field), and the single
character typed disappear. I don't know why it does one or the other.

I tried using Recordset's Update, and RunCommand acSaveRecord, to no
avail.

Any other suggestion?

I use MS Access 2003, BTW.

Thank you!

--
Stephan Paul Arif Sahari Wibowo
_____ _____ _____ _____
/____ /____/ /____/ /____
_____/ / / / _____/ http://www.arifsaha.com/
Nov 13 '05 #1
2 2031
HJ
I believe I can make two observations:

1. Your data may need restructuring or your forms needs to be restructured.
If form3 can be used without using form2, then why do you need to show form2
in the first place?
2. Without restructuring anything, you can have an AfterInsert event for
form3 that checks whether any records exist for form2. Then, if no records
exist for form2 you can add records directly to the underlying table and
then refresh form2. After that you can return the focus to form3 or any
other place.

HJ

"S P Arif Sahari Wibowo" <ar******@yahoo.com> wrote in message
news:Pi******************************@localhost.lo caldomain...
Hi!

Do you know how to put a form's Access-Visual-Basic-code that will force
the form to be inserted, while the user has not type anything in the form,
without changing focus, selection, etc.?

Here is the story.

I have this structure:

Table1 <-one-many-> Table2 <-one-many-> Table3

The forms follow that structure:

Form2 (of Table2) subform of Form1 (of Table1)
Form3 (of Table3) subform of Form2 (of Table2)

Now, the records in Table2, although have their own fields, that fields
not always filled by users, and sometime just act as "holder" for a group
of Table3's records. So in the form, sometime users have nothing to type
in Form2, but want to type into Form3 directly. But since Form2 is not
typed in yet, the record is not created yet, and therefore what they type
in Form3 will just gone (not linked to anything).

So what I tried to do, is but an event handler (of BeforeInsert event) in
Form3, calling another code in Form2 or other place if necessary, get that
form "inserted" (get the record created). However, since this will happen
in the middle of the user typing in Form3, it should happen without
changing focus and selection.

So far the only thing can do the insertion, is by having a code moving
some data into 1 or more fields in Form2, and then call the method Requery
or Refresh from Form2. Unfortunately, this reset the Forms display, with
Requery the focus shifted to the first field in Form2, with the Refresh,
either the typing hairline change into selection of that particular field
(in Form3), or Form3 get reset (focus to first field), and the single
character typed disappear. I don't know why it does one or the other.

I tried using Recordset's Update, and RunCommand acSaveRecord, to no
avail.

Any other suggestion?

I use MS Access 2003, BTW.

Thank you!

--
Stephan Paul Arif Sahari Wibowo
_____ _____ _____ _____
/____ /____/ /____/ /____
_____/ / / / _____/ http://www.arifsaha.com/

Nov 13 '05 #2
I do not understand what you mean by "force the form to be inserted". We do
not normally describe forms in Access being "inserted", so it would be
helpful if you could clarify this for us. And, alas, I am confused when I
read your additional description. (Of course, there are those here who would
think it not unusual for me to be confused -- and they might not even
qualify that with a :-).)

Larry Linson
Microsoft Access MVP

"S P Arif Sahari Wibowo" <ar******@yahoo.com> wrote in message
news:Pi******************************@localhost.lo caldomain...
Hi!

Do you know how to put a form's Access-Visual-Basic-code that will force
the form to be inserted, while the user has not type anything in the form,
without changing focus, selection, etc.?

Here is the story.

I have this structure:

Table1 <-one-many-> Table2 <-one-many-> Table3

The forms follow that structure:

Form2 (of Table2) subform of Form1 (of Table1)
Form3 (of Table3) subform of Form2 (of Table2)

Now, the records in Table2, although have their own fields, that fields
not always filled by users, and sometime just act as "holder" for a group
of Table3's records. So in the form, sometime users have nothing to type
in Form2, but want to type into Form3 directly. But since Form2 is not
typed in yet, the record is not created yet, and therefore what they type
in Form3 will just gone (not linked to anything).

So what I tried to do, is but an event handler (of BeforeInsert event) in
Form3, calling another code in Form2 or other place if necessary, get that
form "inserted" (get the record created). However, since this will happen
in the middle of the user typing in Form3, it should happen without
changing focus and selection.

So far the only thing can do the insertion, is by having a code moving
some data into 1 or more fields in Form2, and then call the method Requery
or Refresh from Form2. Unfortunately, this reset the Forms display, with
Requery the focus shifted to the first field in Form2, with the Refresh,
either the typing hairline change into selection of that particular field
(in Form3), or Form3 get reset (focus to first field), and the single
character typed disappear. I don't know why it does one or the other.

I tried using Recordset's Update, and RunCommand acSaveRecord, to no
avail.

Any other suggestion?

I use MS Access 2003, BTW.

Thank you!

--
Stephan Paul Arif Sahari Wibowo
_____ _____ _____ _____
/____ /____/ /____/ /____
_____/ / / / _____/ http://www.arifsaha.com/

Nov 13 '05 #3

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

Similar topics

13
by: Mikko Ohtamaa | last post by:
From XML specification: The representation of an empty element is either a start-tag immediately followed by an end-tag, or an empty-element tag. (This means that <foo></foo> is equal to...
2
by: Mike Preece | last post by:
Hi I have to apologise for this in advance.. Sorry I know this is the wrong group to ask but this question I don't know where I should be asking it. What can I send from the server to a...
3
by: Clark Spencer | last post by:
I have built a small integration app using VS .NET 2003 that extracts orderinformation from a 'webshop'. Extracting the orderinformation works fine. Appending the order elements in the...
2
by: Terry | last post by:
I have cerated a Form, ExamsFrm, which is used to input details of exams taken at several Centres. It dosplays details from StudentTbl and has a SubForm which displays details from ExamsTble. I...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
22
by: Br | last post by:
First issue: When using ADPs you no longer have the ability to issue a me.refresh to save the current record on a form (the me.refresh does a requery in an ADP). We usually do this before...
12
by: Cmtk Software | last post by:
I'm trying to define an enum which will be used from unmanaged c++, C++/CLI managed c++ and from C#. I defined the following enum in a VS dll project set to be compiled with the /clr switch: ...
8
by: Red | last post by:
If auto-format is turned off in VS2008, there is apparently no way to indent a line. Under Tools->Options->Text Editor->C#->Formatting, there are three checkboxes. Unchecking those seems to cause...
4
by: AAaron123 | last post by:
<body runat="server" id="MainBody"> <form id="form1" runat="server" style="background-color:green; width: 100%; height: 100%"> <br /> Table1" runat="server" Style="background-color:Yellow;...
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
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
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
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
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.