Added table to split database - now have error (1 Viewer)

Gaztech

Member
Local time
Today, 01:06
Joined
Jan 5, 2021
Messages
39
Hi guys,

I have a split database with 7 tables. It's currently working just fine with an Access stock system that I wrote a few months ago.

I just added two more tables to the backend database to add a record of repairs to stock. I then removed all of the tables from the application and re-linked everything. Everything as before. works just fine. No errors. But...

I then wrote another "form". As this form is very similar in operation to another one in the system I have, I generated a copy and modified the new form for the new purpose merely changing the text box references, names and all the pointers/code to the new tables (just to give you an idea of the background of how I did this).

I have a Save routine (on a button) that in the opening few lines of code, specifies the database file to open the connection to be:

"mydb = Me.DBinUse"

which is the current database that I am using. On all other forms this command works fine. On the new form it doesn't.

The command on this new form always throws an error which states: "Compile Error: Method or data member not found"

Ok, so... Bearing in mind that a lot of the code here was originally part of another form, If I try and code this on the old form (the one I got the layout from), when I type Me. the dropdown list appears to give you the option to select an "entity".

"DBInUse" IS on this dropdown list and I can select it.

On the new form, if I try to code it and type Me. "DBInUse" isn't in the drop down list. This is obviously at the root of the problem hence the "Method or Member not found" message. what I don't understand though is where the form gets this property variable or member from?? It's not a variable on either form.

I'm using the "Change Backend Database" routine that I found on here somewhere. It works very well and I've not had any issues up to now. I'm not sure if this routine is interfering or has anything to do with the DBInUse entry. Maybe it regsiters this name/word somewhere. Can anyone confirm this?

What I do know though it that a variable isn't being called globally as on all the forms that work (and this one) there is no Option Explicit defined to pick a variable up. It must be a part of the system somewhere. Question is: How to I bring it into this particular form?

I apologise if what I'm saying here isn't clear and I hope someone knows what I'm on about!

Thanks guys.
 

Gasman

Enthusiastic Amateur
Local time
Today, 00:06
Joined
Sep 21, 2011
Messages
9,276
So search for it in a form that is working?
 

Ranman256

Well-known member
Local time
Yesterday, 19:06
Joined
Apr 9, 2015
Messages
3,957
I hope the actual code does not use quotes around the line: "mydb = Me.DBinUse"
it should be: mydb = Me.DBinUse

is DBInUse defined via DIM or PUBLIC?
 

Gaztech

Member
Local time
Today, 01:06
Joined
Jan 5, 2021
Messages
39
I hope the actual code does not use quotes around the line: "mydb = Me.DBinUse"
it should be: mydb = Me.DBinUse

is DBInUse defined via DIM or PUBLIC?
This is the problem... I can't actually find DBinUse anywhere! Yet it works on the other forms. If I could find it, I'd know what is going on.
That's why I think it might be part of the "Change Backend Database" routine. I'm going to chase it down through there first. And no, I'm not using the quotes :).
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:06
Joined
Oct 29, 2018
Messages
17,113
Hi. In the Design View of the Form that works, go to the Properties panel and click the dropdown to look for DBinUse. If you see it, select it to see where it is on the Form. If it's not there, then you might consider posting a copy of your Form for further examination.
 

Gaztech

Member
Local time
Today, 01:06
Joined
Jan 5, 2021
Messages
39
Ahhh!!! I found it. It was a textbox that was hiding under the footer line at the bottom. It simply wasn't showing when I viewed it in design view. It's no wonder I couldn't see it or find it!

Sorry guys. Me being a dumbass! I feel really stupid now...
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:06
Joined
Oct 29, 2018
Messages
17,113
Ahhh!!! I found it. It was a textbox that was hiding under the footer line at the bottom. It simply wasn't showing when I viewed it in design view. It's no wonder I couldn't see it or find it!

Sorry guys. Me being a dumbass! I feel really stupid now...
Hi. Congratulations! Glad to hear you got it sorted out.
 

Gasman

Enthusiastic Amateur
Local time
Today, 00:06
Joined
Sep 21, 2011
Messages
9,276
So why was it not present on the new form, if you copied another form?
 

Gaztech

Member
Local time
Today, 01:06
Joined
Jan 5, 2021
Messages
39
So why was it not present on the new form, if you copied another form?
Now... That is a question I can't answer! It's an obvious thing to assume.

I have no idea at all. I copied the form, renamed it and then edited it. I'm sure it's something I did but I can't recall as I did the process a few times as I couldn't understand what had happened. Maybe each time, for some reason it wasn't copied over... I will investigate this and if I find the reason I'll post it here.

I would have thought that it would have copied it over. Very odd indeed...
 

JMongi

Active member
Local time
Yesterday, 19:06
Joined
Jan 6, 2021
Messages
625
I generated a copy and modified the new form for the new purpose merely changing the text box references, names and all the pointers/code to the new tables (just to give you an idea of the background of how I did this).
"I generated a copy" is a hair ambiguous. Did you copy the form object itself or did you have some sort of streamlined form generation that still started with a blank form (for example copying and pasting form elements from the old form to the new form)?
 

Users who are viewing this thread

Top Bottom