Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Missing Form Members

Status
Not open for further replies.

mrees

Programmer
Feb 20, 2003
197
GB
Microsoft Access 2k and SQL2k.

Dear all,

I have to make some amendments to an Access front-end, created by a now departed colleague. Basically it is a series of forms that allows users within my company to enter information into a "temporary" holding table in Access. This information is then pushed into a SQL table when the user finally clicks the save button. The method to get the data into SQL is as below.

Code:
Global cnn As New ADODB.Connection
Global rs As New ADODB.Recordset
Global Provstr As String

cnn.Provider = "sqloledb"
Provstr = "Server=MyServer;Database=MyDbase;Trusted_Connection=yes"

ADODBConnect.ADOBCOnnect
cnn.Open Provstr
cnn.saddcomp2 Item1,Item2,Item3,Item4,MyNewItem1,rs
cnn.Close
Set cnn = Nothing
In this case, the first four items were present before I got my hands on this, they are the columns from the temporary Access table. I just had to add the last one "MyNewItem1". EASY! but...

I created the new column on both the SQL and Access tables. I created a new text box on my form and set its control source to the new Access column. When I enter data into this new text box, it goes into my access table - all well and good so far. All I need to do is add this to my connection string as in my code above. But the VB editor won't seem to recognise it, it does not appear as a member of the form in the object browser as the others do. I can reference the name of the text box instead in the connection string, and it works fine all the way up to and including populating SQL. But I would prefer if the control source was referenced as with all the other parameters.

I am not that familiar with Access, is there something obviously wrong that I am doing?

Thanks in advance

mrees
 
Did you first save the form before trying to add it in the code? I would think that would cause this situation.

Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
Possibly, I've been in and out of it so many times trying different things. How would saving the form before changing the code have any detrimental effect? How can I resolve it?

mrees
 
Well, I noticed once before that after I had added a new form control without saving the form, and immediately began to enter some vba code that referenced the control, that it would not be listed in the shortcut menus. However, if I saved the form, then entered the code, viola! the reference was there!

Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
I have tried that but with no luck.

I have noticed that when I right click on each parameter in my connection string. I get the "Quick Info" option. Some come up with "Parameter1 As AccessField". Other just have "Parameter2 As Textbox". When I created my new fields on my form, I copied already present textboxes and altered them accordingly. The fields that don't appear are all "As AccessField", the others that I added and do work (ie available to use in VBA) are all "As Texbox". What is this AccessField? Am I missing a reference or something?

HELP!

mrees
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top