473,500 Members | 1,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

browseto nightmare

5 New Member
Hi all,

First post, but long time browser.

I have been using browseto over the years with mostly a good outcome, however I have now encountered some strange behaviour.

I have a button which onclick changes to a different form. I can make this work fine, however on the onclick before the browseto command I have some vba code to check that all data on the form is correct before moving on.

The vba code is very simple, eg
Expand|Select|Wrap|Line Numbers
  1. If Text52 < 0 And Text61 > 0 Then
  2. P1answer = MsgBox("You have put different sign powers, do you want to edit?", vbQuestion + vbYesNo + vbDefaultButton2, "TEST")
  3. If P1answer <> 7 Then
  4. Exit Sub
  5. End If
  6. End If
Very simple stuff, however code as simple as that will cause the browseto to runtime 6054 error.

If someone clicks "no", it results in a runtime error 6054.

If someone clicks "yes", then tries to click the button again, and then clicks "no", it works second time as intended.

I have tried simplifying the code to things a simple as if 1>0 etc, however it seems any statement seems to trigger a browseto error on this form.

Any ideas?
Jun 28 '21 #1
8 4383
NeoPa
32,557 Recognized Expert Moderator MVP
Hi there, & welcome to Bytes.com.

Let me start by pointing out that 6054 is an error code. With an error code you will always have the message that code represents, which makes the error make sense to anyone trying to help. That makes life easy, which is why it's always provided.

Your further explanation discusses what happens when the code is run again - yet doesn't explain the logic you're using that makes that possible.

I don't see what's wrong here, but I also only see a fraction of what I need to in order to understand what it is you should be explaining to me (us).

At no point does the code reference, or illustrate, any interaction with BrowseTo.
Jun 29 '21 #2
hilmi123
5 New Member
Hi NeoPa,

Let me try to explain further.

"let me start by pointing out that 6054 is an error code. With an error code you will always have the message that code represents, which makes the error make sense to anyone trying to help. That makes life easy, which is why it's always provided."

The error code I have uploaded an image to illustrate, it suggests the path to the browsed form is incorrect.

This is not the case. As I mentioned, if I remove the simple code that has no bearing on the path, the browseto works fine.

Even if I leave the code in, it works if I click the button which references the browse to code on the second attempt.

"Your further explanation discusses what happens when the code is run again - yet doesn't explain the logic you're using that makes that possible."

So I have a button, when the button is clicked, it will do some checks on the data on a subform, and if all is ok, it will change the form in the subform to a different one. However if the data is not correct, it will show a prompt to the user to check the data. If they select that they are happy with the data, then the VBA will attempt the browseto, at this point the error 6054 will appear. If the user opts to change the data, but actually does nothing, then when then the data check prompts shows again (because the data is still questionable), if the user opts this time to say the data is fine, the browseto code is used and it works without any errors.

"At no point does the code reference, or illustrate, any interaction with BrowseTo."

This is the problem Im trying to fix. The browseto works in isolation, but not when used in certain mundane situations.

For reference, here is the browseto Im using.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.BrowseTo ObjectType:=acBrowseToForm, _
  2. ObjectName:="Patients", _
  3. PathToSubformControl:="Main Menu.NavigationSubform", _
  4. WhereCondition:="[Patient ID] =" & Me.PatientID, _
  5. DataMode:=acFormEdit
This all suggests there is nothing wrong with the code per se, but there is a bug in Access. What Im looking for is either some help understanding browseto command or a work around, does anyone have an ideas?
Attached Images
File Type: jpg 6054.jpg (19.7 KB, 52 views)
Jun 29 '21 #3
isladogs
457 Recognized Expert Moderator Contributor
In over 20 years of using ACCESS, I cannot recall ever using BrowseTo in my own code.
Please can you explain what you are using it for. There may well be another/better approach.
Jun 29 '21 #4
hilmi123
5 New Member
isladogs,

I have a navigation set up with buttons on the left side.

The "main menu" is always open, and the changeable subform is "NavigationSubform".

So for example lets imagine I am on form x and I want to go back to the "home" form for the NavigationSubform, I would use a browseto command to change the form loaded in the NavigationSubform.

The problem is, if you search you will find the browseto command is at best buggy, but basically not working. You can have it working, and then change something completely unrelated and then it will stop working. I noted on this forum there are countless examples.
Jun 29 '21 #5
NeoPa
32,557 Recognized Expert Moderator MVP
Hilmi123:
The error code I have uploaded an image to illustrate, it suggests the path to the browsed form is incorrect.
Please don't do it that way. Anyone reading this would have to link to the image file just in order to understand the question. That isn't cool. Many can't even do so due to restrictions - especially if looking from a work environment - but even if they could it's not everyone else's job to work out what the question should be.

Nevertheless, we do at least have an error message now :
Access Error:
Run-time error '6054':

The macro action BrowseTo requires a valid Path argument. A valid Path argument is of the form: MainForm1.Subform1>Form1.Subform1
I struggle to work out what it's trying to say - but one thing is very clear :
It requires a valid Path argument. Except of course there is no Path argument from what I can see. I assume it must be referring to the PathtoSubformControl argument. I admit to being a little confused by the format indicated as required within the error message but I would lay money it's not going to like a space in the name without [] around it. That's pretty much a given. What else it's trying to say confuses me. Luckily I don't use it myself but I agree that some better explanation and clearer instructions would be helpful.
Hilmi123:
This all suggests there is nothing wrong with the code per se, but there is a bug in Access.
I disagree. I think it indicates you have a limited understanding of the tools you're trying to use. No great shame there - I find it very confusing myself. However, we're a long way from that statement at this point as far as I can see. Fix the obvious errors first then think about Access being wrong. I'll support "Access explains things unhelpfully at times.", but that's as far as I see for now.

So, from all I've seen so far and I've read to the end at this point, you have a main Form called [Main Menu]. On this main Form you have a Subform Control named [NavigationSubform] and your intention at different stages of your process is to show different Form objects within this same Subform Control on your main Form.
Hilmi123:
The problem is, if you search you will find the browseto command is at best buggy, but basically not working. You can have it working, and then change something completely unrelated and then it will stop working. I noted on this forum there are countless examples.
As IslaDogs hinted at, there are better ways of handling what you want to do. Generally speaking I avoid macro actions where possible - even when instigated via DoCmd. They can be really useful to have available but where options exist to manage things via the objects themselves I prefer to use that approach.

Your asking of questions may leave a bit to be desired but I'm seeing a level of programming competence such that this shouldn't frighten you. Subform Controls have three very important Properties beyond their names - [SourceObject], [LinkChildFields] & [LinkMasterFields]. By playing with these you can roll your own code to switch the Forms used within a Subform Control. That's how I'd do it. Obviously (I hope.) be very careful of how you use names of objects. If you have to include spaces then you'll have to learn how to refer to them properly. Avoid spaces in names for an easier life.

Sorry for the long post - but you've asked an interesting question and it deserves a detailed answer.
Jun 29 '21 #6
hilmi123
5 New Member
Hi NeoPa,

Thanks for trying, but I dont think you understand.

In reality this is a very simple situation.

The code to change the form in navigationsubform works in some situations and not others. The factor that makes it not work is the code that is running before the BrowseTo cmd.

Eg if there is a dialogue box in my case.

So this works

Expand|Select|Wrap|Line Numbers
  1. DoCmd.BrowseTo ObjectType:=acBrowseToForm, _
  2. ObjectName:="Patients", _
  3. PathToSubformControl:="Main Menu.NavigationSubform", _
  4. WhereCondition:="[Patient ID] =" & Me.PatientID, _
  5. DataMode:=acFormEdit
Expand|Select|Wrap|Line Numbers
  1. If Me.Text74 = 0 And Forms("Main menu").Text242 > 42 Then
  2. ' R no add
  3. Ranswer = MsgBox("Are you sure blah blah", vbQuestion + vbYesNo + vbDefaultButton2, "PMS")
  4. If Ranswer <> 7 Then
  5. Exit Sub
  6. End If
  7. End If
  8.  
  9. DoCmd.BrowseTo ObjectType:=acBrowseToForm, _
  10. ObjectName:="Patients", _
  11. PathToSubformControl:="Main Menu.NavigationSubform", _
  12. WhereCondition:="[Patient ID] =" & Me.PatientID, _
  13. DataMode:=acFormEdit
  14.  
  15.  
That does not work, it results in the RTE 6054. The error also be triggered by running any kind of DAO.
Jul 6 '21 #7
PeterTheme
1 New Member
Hi Hilmi123
My thought is that Me.PatientID may not be set correctly and the PathError is just misleading. You may want to try using aTempvars in place of the Me.PatientID.

Looking at the name of the Navigation form you appear to be using the Navigation control. On the "Data" tab of your Navigation buttons you will find properties "Navigation Target Name" and "Navigation Where Clause" so you can avoid using BrowseTo. You would need to set DataMode in the form Open or Load event.

I only occasionally use BrowseTo on my Navigation forms if the Button data settings won't provide sufficient control.

The only bug I have found in Navigation controls, that was acknowledged by Microsoft, was in 2010 runtime version. It only failed when there were 2 rows of horizontal navigation buttons. It worked fine in full Access.
Jul 7 '21 #8
NeoPa
32,557 Recognized Expert Moderator MVP
Hilmi123:
Thanks for trying, but I dont think you understand.

In reality this is a very simple situation.
Excellent. You seem to be understanding the situation better now. I can't understand what you're saying until what you're saying starts to make some sense & include the information I need in order to understand what you're saying.

It's a simple situation too. Excellent. I'm sure that sometime soon you'll manage to explain it clearly then. All the clues as to what you need to do in order to make sense are in my earlier posts. I'm sure we can make some progress soon if you read what I say and post something that makes your situation clear.

Alternatively, if you continue simply to repeat what we already know to be very unclear then I will stay confused and will not be able to help you further.
Jul 7 '21 #9

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

Similar topics

1
2289
by: Drisco | last post by:
Hello, I realy need help,Searched the NG for a days with no vail. Sorry for the long script. I am trying to get a variable from php to flash. I have the following code in php <a...
0
1366
by: Deena | last post by:
Hi Windows forms layout is turning to be a nightmare. I add my controls to a form and then save it and then it just get's all messed up. I'm using inheritance if this makes any difference. Also...
4
3035
by: Dave | last post by:
Hello All, I am having a nightmare trying to add a new row to my Datagrid. When I use the code below I get the error: 'Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. Can...
6
1338
by: Jim Mirra | last post by:
Hey, I have been working on this for a while now and I keep getting the same error. here is my code: ------- start code --------- Dim strSQL = "Select tagid,itemid,description,status,...
2
2267
by: Afshar | last post by:
Dear nice people around the world! Please help ending this nightmare, I have 2 problem with ASP.NET Menu control First: I have a horizontal menu at top of my page, each item have some sub-items...
3
1570
by: Samuel Shulman | last post by:
I get the following error Error 2 Could not load file or assembly 'RusticiSoftware.ScormContentPlayer.Logic, Version=2006.1.2576.40320, Culture=neutral,...
10
2096
by: Andrew Wan | last post by:
I have been having a nightmare with ASP/ASP.NET & IIS6. We use Msxml2.DOMDocument.4.0 object to create a XML object in ASP. The Msxml2.DOMDocument.4.0 is from the Windows Platform SDK Feb 2003...
1
1274
by: =?Utf-8?B?TWVyZGFhZA==?= | last post by:
I am using ASP.NET 2.0 C# I am getting errors when I publish my site. It works fine on our local server. Pages that have maintainscrollpositiononpostback=true set, get errors such as:...
12
4190
by: CharT | last post by:
I could use some help with the BrowseTo feature in access 2010. I have searched for and read everything I can find on the web... which wasn't much. Can browseto be used on a form other than a...
7
9216
hyperpau
by: hyperpau | last post by:
Hi All, It's nice to be back. I just got my hands on Access again and I was surprised that the magic is still there. However, the new Navigation Forms in 2010, replacing the switchboard, is...
0
7134
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
7014
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
7229
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
7395
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...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4921
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
4609
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...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.