PDA

View Full Version : Solved: Help! How do i use data from a access tabe and put it into multiple textboxes in a



Zephid15
02-19-2007, 07:56 AM
NEED HELP! How do i use data from a access tabe and put it into multiple textboxes in a form for word.

i am attepmting to take the data and add it in a form so i do not have to edit code, just the database, to add/remove data.

fumei
02-19-2007, 10:31 AM
You are going to have to explain in better detail. i am not seeing the connection between paragraph 1:

putting data into multiple textboxes

and paragraph 2:

do not have to edit code, just the database, to add/remove data.

Edit code? What code?

As for multiple textboxes, you have data (text I presume). Split it up anyway you want. Put it in the textboxes. What exactly is the problem?

Zephid15
02-20-2007, 10:40 AM
sorry about the poor description


ok i have an acess table of product data. say "Number, Name, Description, Price" and there are 5 products total.

so my table in acess looks like this:

Number1 Name1 Description1 Price1
Number2 Name2 Description2 Price2
Number3 Name3 Description3 Price3
Number4 Name4 Description4 Price4
Number5 Name5 Description5 Price5

Now when i open this word template that i am constructing i have a form pop up. in the form i have 20 text boxes 4X5 shaped like the table.

now i am doing it like this because i have alrety writen the code that say when the corisponding check box value is false then i want to disable that row.


Sub Checkbox1_change()
If CheckBox1.Value = False Then
TextBoxq1.Enabled = False
TextBox1a.Enabled = False
TextBox1b.Enabled = False
TextBox1c.Enabled = False
TextBox1d.Enabled = False
TextBox1e.Enabled = False
Else
If CheckBox1.Value = True Then
TextBoxq1.Enabled = True
TextBox1a.Enabled = True
TextBox1b.Enabled = True
TextBox1c.Enabled = True
TextBox1d.Enabled = True
TextBox1e.Enabled = True
End If


End If
End Sub


so in the form it looks like this:

Checkbox1 Number1 Name1 Description1 Price1
Checkbox2 Number2 Name2 Description2 Price2
Checkbox3 Number3 Name3 Description3 Price3
Checkbox4 Number4 Name4 Description4 Price4
Checkbox5 Number5 Name5 Description5 Price5

if checkbox1 is not checked then all of row 1 is disabled

Zephid15
02-20-2007, 11:58 AM
ok i solved it my self...

Sub GetProductData()
Dim recnum As Integer
Set oRS = New ADODB.Recordset
oRS.Open "QPRData", oConnection, adOpenForwardOnly, adLockReadOnly, adCmdTable
recnum = 1
Do While Not oRS.EOF
PROdata(recnum, 1) = "" & oRS("Priority")
PROdata(recnum, 2) = "" & oRS("Number")
PROdata(recnum, 3) = "" & oRS("Name")
PROdata(recnum, 4) = "" & oRS("Description")
PROdata(recnum, 5) = "" & oRS("Category")
PROdata(recnum, 6) = "" & oRS("Price")
PROdata(recnum, 7) = "" & oRS("Defalt")
recnum = recnum + 1
oRS.MoveNext
Loop
oRS.Close
Set oPR = Nothing
oConnection.Close
Set oConnection = Nothing
End Sub

Zephid15
02-22-2007, 01:42 PM
how do i mark this solved?

lucas
02-22-2007, 02:30 PM
Use the thread tools at the top of the page to mark your thread solved.