Transferring Userform Textbox Values to Access

SINGERT

New Member
Joined
Jun 25, 2015
Messages
11
Hello!
I'm relatively new to Access and have limited VBA programming skills. I have created a userform that lets people enter the different gauging values from various points on a part. There are also "click" buttons that they use to show if something "passed" or "failed" When I submit the userform, the "pass/fail" information transfers over just fine, but the numerical data entered into the Textboxes transfers as 0. I'm not sure what I'm doing wrong? Any thoughts?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
not from your info.
What is in the text box?
How is the data transfering? Via ODBC?, query?
What is the data type in the table where you save it?
 
Upvote 0
The information in the text boxes is simply numbers (operators read a gauge, input the reading to the textbox). When it is submitted, excel opens the Access database and sets the field with the same name = to the value in the corresponding textbox (or at least it should). The fields for these values are just number fields.
 
Upvote 0
Do you have the code?
Ive never gone from XL to access, its always been the reverse.
Why wouldnt you just enter the data straight into Access? Why bother with XL?
 
Upvote 0
The computers out on the shop floor do not have Access installed on them, only Excel. I want to take their information and store it in a database. Here is some of my code (not sure if I'm entering it correctly):

Code:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = DAO.DBEngine.OpenDatabase("S:\Machine Shop\Quality\MS Gauge Data.mdb")
Set rs = db.OpenRecordset(ThisWorkbook.GPartStyle, dbOpenDynaset)


rs.AddNew
rs!TimeStamp = Now
rs!Spec1 = Val(Gearcase.Spec1_TextBox.Value)
rs!Spec2 = Val(Gearcase.Spec2_TextBox.Value)
rs!Spec3 = Val(Gearcase.Spec3_TextBox.Value)
rs!Spec4 = Module1.GNG(1)
rs!Spec5 = Val(Gearcase.Spec5_TextBox.Value)
rs!Spec6 = Module1.GNG(2)
rs!Spec7 = Val(Gearcase.Spec7_TextBox.Value)
rs!Spec8 = Module1.GNG(3)
rs!Spec9 = Module1.GNG(4)
rs!Spec10 = Module1.GNG(5)
rs!Spec11 = Module1.GNG(6)
rs!Spec12 = Module1.GNG(7)
rs!Spec13 = Module1.GNG(8)
rs!Spec14 = Module1.GNG(9)
rs!Spec15 = Module1.GNG(10)
rs!Spec16 = Module1.GNG(11)
rs!Spec17 = Val(Gearcase.Spec17_TextBox.Value)
rs!Spec18 = Module1.GNG(12)
rs!Spec19 = Val(Gearcase.Spec19_TextBox.Value)
rs!Spec20 = Val(Gearcase.Spec20_TextBox.Value)
rs!Spec21 = Val(Gearcase.Spec21_TextBox.Value)
rs!Spec22 = Val(Gearcase.Spec22_TextBox.Value)
rs!Spec23 = Module1.GNG(13)
rs!Spec24 = Val(Gearcase.Spec24_TextBox.Value)
rs!Spec25 = Module1.GNG(14)
rs!Spec26 = Module1.GNG(15)
rs.Update
Code:
 
Upvote 0
but you said: "When it is submitted, excel opens the Access database"
If they dont have Access how does this open access?

and what is
Module1.GNG(1)
are you getting values from a module?

and which one are you having problem with?
 
Last edited:
Upvote 0
Sorry, they are all on a network. The floor computers have Excel with then opens the network shared folder to drop the information into the Access database (Set db = DAO.DBEngine.OpenDatabase("S:\Machine Shop\Quality\MS Gauge Data.mdb"))
\
Module1.GNG(1) is one of the click buttons in module1 (Go-NoGo gauge).
 
Upvote 0
Okay, I think I got it figured out...Well, my boss did anyway. For some reason it decided that it didn't like the explicit naming (Gearcase.Spec1_Textbox.Value). We removed the Gearcase from it and it pulled it over just fine. Not sure what made it not like that as it was pulling the information from a previous sheet done the same way just fine? Thanks for you help!
 
Upvote 0
So it doesnt open access, it just sends data via a connection.
but,
modules do NOT have buttons, only forms do. Your descriptions are too confusing for help.
so either you are not getting data from the right source,
or the code is saving to the wrong field.
 
Upvote 0
The fields in Access populated, it's just that they filled with 0's instead of the information typed in. I know modules don't have buttons, but module1 is where I declared the public variables, so I am stating that I want to use that variable in module1. The Gearcase description was the same way, that is one of my userform names, I was declaring that I want to use the Spec1 variable from the Gearcase userform. For some reason it didn't like me specifying the Gearcase location. It is working now, with just a few more bugs to figure out. Thanks for your time on this, and sorry for any confusion...1st time posting to something like this.
 
Upvote 0

Forum statistics

Threads
1,221,852
Messages
6,162,431
Members
451,765
Latest member
craigvan888

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top