Hello. I have two public varibles in a module that have a number assigned to
each one. I also have a form where, when i press a button, i want the values
of each varible added to a table. The varibles are Public Record As Integer
and Public License As Integer.
The table has two fields, Hardware ID and License ID. I need Record to be
added to Hardware ID and License to be added to License ID.
It matters not to me how this gets done, i just need it to work.
Thanks for any help!!
Brian
Ofer - 02 Feb 2006 18:13 GMT
Try
Docmd.RunSql "INSERT INTO TableName ([Hardware ID] , [License ID]) VALUES ("
& Record & ", " & License & ")"

Signature
\\// Live Long and Prosper \\//
BS"D
> Hello. I have two public varibles in a module that have a number assigned to
> each one. I also have a form where, when i press a button, i want the values
[quoted text clipped - 7 lines]
>
> Brian
Brian - 02 Feb 2006 18:35 GMT
Thanks alot!! Works great :)
Brian
> Try
>
[quoted text clipped - 12 lines]
> >
> > Brian
Onne - 24 Apr 2006 13:16 GMT
Hi!
I tried to use the same code:
Docmd.RunSql "INSERT INTO TableName ([HardwareName] , [License ID]) VALUES
("& tbName & ", " & License & ")"
For numbers this works fine, although for inserting text boxes into a table
field (data type: text) it doesn't.
I receive a prompt to enter "Parameter Value". When I insert the text in
this prompt it does insert it into the table. But of course this isn't a good
solution when you have to insert all the data via a popup screen...
Who can help me?
Thanks in advance!
Onne
> Thanks alot!! Works great :)
>
[quoted text clipped - 16 lines]
> > >
> > > Brian
Marshall Barton - 02 Feb 2006 18:38 GMT
>Hello. I have two public varibles in a module that have a number assigned to
>each one. I also have a form where, when i press a button, i want the values
[quoted text clipped - 3 lines]
>added to Hardware ID and License to be added to License ID.
>It matters not to me how this gets done, i just need it to work.
One way is to open a recorset to the table:
Dim db As Database
Dim rs As DAO.Recordset
Set db = CurerntDb()
Set rs = db.OpenRecordset("thetable")
rs.AddNew
rs![Hardware ID] = Record
rs![License ID] = License
rs.Update
rs.Close : Set rs = Nothing
Set db = Nothing

Signature
Marsh
MVP [MS Access]