Help with Function:Return answer to the table

B

BigMike044

Help, I have a function that will convert bytes to gb, mb etc. I am very
new to programming and writing functions and my issue is: I can call the
function and enter in my value and get the answer in the immediate window,
but how do I get that same answer to be written to a table automatically.

Example: Results in the immediate window
? SetBytes (79990845440)
74.50 GB

I would like to have this 74.50 GB written to a field in a access table:
Please give me some insight on how to proceed. I have done many searches with
no good result. Thanks
 
O

Ofer

You can use an update query

UPDATE TableName SET TableName.FieldName = SetBytes ([FieldName2])

The parameter sent to the function is another field from the table.
 
O

Ofer

Another option will be to open a recordset

Dim MyDB as database, MyRec as Recordset

Set MyDB=codedb()
Set MyRec=MyDB.OpenRecordset("TableName")
MyRec.Edit
MyRec!FieldName= SetBytes (ParamSent)
MyRec.Update
 
P

PC Datasheet

You don't need a function at all! All you need is a field named MyGigaByte
in your table. You include this field on your form and make it hidden (not
visible). You add an unbound textbox named EnterValueHere on your form. This
is where you type in 79990845440. Then you put the following code in the
Afterupdate event of that textbox:
Me!MyGigaByte = Me!EnterValueHere * <your formula for conversion>
74.50 will get saved to the table!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top