In my access application, there are four main forms and each form has tab control with other two sub forms.
There is data transmission between access and other database, which subform will call batch file to run to update data on access table. During running batch file, user can click on any form. After batch file finish running, I have place me.requery.
Could anybody tell me what is me refer to? is it refer to the form in vba code or the form the get focus? I have this problem because after calling me.requery from that sub form, the new data didn't show up, I have to set focus on other form then go back to it again, then it will shows new data.
Me always refers to the object (which can be a form or a report.) associated with the module the reference is in.
IE. If your main form is called frmMain and you have an associated module with that (Form_frmMain) then any reference within that module will refer to that specific form.
Would you mind to explain in an easy way cuz i'm not really understand this? On my subform, I have button which will call module code to run. Does this module is what you mean?
I'm really sorry for that. I have this problem cuz in my form, on click button event, I have code which will call batch file to run, and this batch file will erase all data from existing ms access table, then import data from Postgresql DB to this access table. And i'm sure that after this batch file finish running, it means that data is already wrote to access table.
But it just so strange, for me.requery it will shows as #Deleted for all record in continuous form. I have to go to other form then come back to this form again, then it will show data again.
So I think about solution as first set focus to other form (its mainform), then set focus back to this form(subform). But there is nothing change.
And when I use msgbox me.name, it shows this subform's name correctly.
So I think that during this VBA code run, we can use mouse to click on any other form, but for VBA code, it still remaining running on the form that we have call it to run.
The above is the reason why I came up with this question.
Sophanna:
"But it just so strange, for me.requery it will shows as #Deleted for all record in continuous form."
I think that's not quite right. I would expect that if you were using Me.Refresh. You should never see #Deleted after a Me.Requery. Please check this before we proceed.
Before I use code that you provide on calling batch file and wait, but it doesn't help, so I tried with code that I got from Microsoft website, but it also doesn't help.
Below is the module code that I use to call batch file
Expand|Select|Wrap|Line Numbers
Option Explicit
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Private Declare PtrSafe Function WaitForSingleObject Lib "kernel32" (ByVal _
hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare PtrSafe Function CreateProcessA Lib "kernel32" (ByVal _
lpApplicationName As Long, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As Long
Private Declare PtrSafe Function CloseHandle Lib "kernel32" (ByVal _
Is your button "btnFillWithNewRevision" by any chance on the Main Form and the data that shows "#Deleted" on a subform? As NeoPa said, with a Requery this is odd to see "#Deleted". However, if your data is on a subform, you may need to requery that subform:
Expand|Select|Wrap|Line Numbers
Me.SubFormName.Form.Requery
That's the only thing I can think of that might help with this. Let us know if this hepps.
Sorry for the long delay. I've been very busy with work commitments to the extent that I haven't visited Bytes for a week or more. Very unusual for me.
Anyway, to get to your problem, your last post (#7) states that the code used to run the batch file is in the second block of code. It seems that this is not exactly true. The code to run the batch file uses a procedure called runBat(). This is not included in the second block of code. What is included is a version of the ShellWait() Function that is different from the one I posted.
Please test the code with the posted version of the ShellWait() function to see if this is where the problem lies. I would certainly only expect to see the results you've described if the batch file had not completed by the time you run the Me.Requery code.
I have a form with a subform (normal) that itself has a subform (datasheet).
I can't get a delete command button to work with the following code. It says
"delete not available now". Any...
Hi,
I made up a nice little form which had its own sub form in it.
I made a litle VB code so that when I pressed a button it would move
form the form (frmConference) to the subform...
I keep getting an invalid property assignment error when tring to
reference a subform.
All I am trying to do is substitute this:
Forms!!.SetFocus
for this:
FormAndSubForm.SetFocus
I have a main form that has a subform which also has a subform:
the main form is
the first subform is
the second subform is
When I click on the button »AddNewSubSubRecord« (add a new record...
Please help! I have 3 forms: Task, Subtask, Elements.
Elements is a subform of Subtask and Subtask is a subform of Task. I
am able to navigate from Task to Subform to Element and from Element to...
running access 2k; adp w/ linked tables to SQL server;
I am absolutely stymied, and ticked off beyond belief - I can not
believe how much time I've wasted trying to do something that should be...
This should be so, so simple I hesitate to ask.
I have a Form named "fNavButtons" used as a SubForm in control named "subformNavButtons". subformNavButtons is a control on my main form named...
I am using Access 2007. I'm trying to set the control on a
subform to the current time. My code is:
Private Sub Command7_Click()
With Me.
..Form.SetFocus
..Form!.SetFocus
RunCommand...
Hello,
I have a main form. I want forms to open in a subform control box.
What is the code for the option group to open the subforms in the
control box.
I didn't create subforms, I created...
I have a main form with a button that makes a subform visible.
I added a button in the form footer of the subform that is supposed to hide the subform. This does not work because the focus is on...
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...
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
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...
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...
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,...
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...
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...
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...