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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting table value from form 1

Status
Not open for further replies.

hyz74

Technical User
Jun 1, 2005
6
SE
I'm kind of lost when it comes to VB coding in MS Access and I'd need some help.

By clicking on a checkbox in my form I'd like the value of a textbox to be inputted in a column called "firstRound" in one of the tables called "roundResults".

How is this possible? Would really appreciate your tips! Thanks!

 
Hi
Something like:
Code:
Dim rs as Recordset
'Assuming a text ID exists on your form
Set rs=CurrentDB.OpenRecordset("Select * From roundResults Where ID ='" & Me!ID & "'")
rs.Edit
rs!firstRound = Me!firstRound
rs.Update
rs.Close
This is just a rough idea.

 
Thanks for the quick reply! I'm getting the picture and I've changed all variables to the correct ones. Still I get this error:

'runtime error '3061' too few parameters. Expected 1.'

My code now looks like this:

Private Sub Kryssruta162_Click()
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("Select * From roundResults Where anmNr ='" & Me!Text174 & "'")
rs.Edit
rs!firstRound = Me!Text107
rs.Update
rs.Close
End Sub


 
Does the roundResults table have a field named anmNr ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Yes, the table roundResults is really basic with not much more fields than anmNr, name, firstRound, secondRound etc.

To me it looks really ok with that code! Still it gives me that error message...
 
And doesn't Text174 contain single quote ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Now I got it to work!! Thanks for helping me! That error message was only due to my own fatigue, been in front of this screen for 25h in a row now... Sorry!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top